TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Israel
701
1.3k
217.2k
How to remove last word separated by a dot (...)
Jan 24 2020 11:31 PM
How to remove last word separated by a dot without displaying messageBox. Just displaying inside textbox
Hi,
My codes need some corrections.
I have into my textbox numbers separated by dot (for example: 1.5.6.7), then I need to remove the last number with the dot before (for example colored in red: 1.5.6.7) . Curiosly its works ONLY separating by space not by dot (for exampe: 1 5 6 7). This number should be fixed only inside of texbox.
private
string
strcut(
string
str)
{
string
[] a = str.Trim().Split(
' '
);
string
str1 =
string
.Empty;
for
(
int
i = 0; i < a.Count() - 1; i++)
{
str1 = str1 + a[i];
if
(a.Count() - 2 != i)
{ str1 +=
" "
; }
}
return
str1;
}
private
void
btnTest_Click(
object
sender, EventArgs e)
{
string
str = textBox1.Text;
MessageBox.Show(strcut(str));
}
Reply
Answers (
6
)
MVC Bind Chart Category and SubCategorywise .
how to marge two database table column value and save anothe