in the next code I wanna detect the space ' ' and the tab '\t' from text file:
//open the file
openFileDialog1.ShowDialog();
textBox1.Text = openFileDialog1.FileName;
FILE_NAME = openFileDialog1.FileName;
System.IO.StreamReader read = new System.IO.StreamReader(textBox1.Text);
ListBox.CheckForIllegalCrossThreadCalls = false;
//using split funtion
sr = new StreamReader(FILE_NAME);
char[] delimiterChars = { ' ', '\t' };
string texto;
texto = read.ReadToEnd();
string[] words = texto.Split(delimiterChars);
foreach (string s in words)
{
listBox1.Items.Add(s);
}
the output of the aplication make a list of any string of the file separte by delimiterChars, but if exist a tab in the file write a line; for example the text is:
111111 22 3333 4444 5555555 6666666666666
between 5555555 and 6666666666666 exist two tab characters.
the best output should be:
111111
22
3333
4444
5555555
6666666666666
using the my aplication the output is:
111111
22
3333
4444
5555555
6666666666666
erase '\t' and only use the space ' ' of the delimiterChar the output is:
111111
22
3333
4444
5555555 6666666666666
how can I resolve this?? thanks.....