Hii All ,
i have a text file contains numbers with the following format , how can i read this numbers to apply math operations on
6666 tab 6666 tab 6666
6666 tab 6666 tab 6666
6666 tab 6666 tab 6666
6666 tab 6666 tab 6666
how to neglect this tab ? and put each 4 digits into avariable ?
then i'll send this varables each one into a cell in Excel
i have a text file contains numbers with the following format , how can i read this numbers to apply math operations on
6666 tab 6666 tab 6666
6666 tab 6666 tab 6666
6666 tab 6666 tab 6666
6666 tab 6666 tab 6666
how to neglect this tab ? and put each 4 digits into avariable ?
then i'll send this varables each one into a cell in Excel
Graham Shorey42 pointsPosted Dec 11, 2006, 4:01 AM EST
You can use the following to split each line of your file into an array
string line;
string[] list;
TextReader tr = new StreamReader(YourFile);
while ((line = tr.ReadLine()) != null)
{
list = line.Split(new char[] {'\t'});
foreach (string line in list)
{
//do stuff with array
}
}
Why would you need your program to output this file to excel when it's already in a format that excel can read?
M Farag5 pointsPosted Dec 12, 2006, 3:49 AM EST
M Farag5 pointsPosted Dec 12, 2006, 3:55 AM EST
Graham Shorey42 pointsPosted Dec 12, 2006, 5:03 AM EST
That's how.