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.
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.
C#:
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));