There is no much special logic around text files. The format you show is purely ad-hoc, there are no real standards about it.
If you have a concern about particular way of separation of the words representing the numbers, you can easily read it line by line and then split every line by a set of separators at once, removing the empty elements, which will give you the desired result. Something like this:
string line =
string[] words =
string.Split(new char[] {' ', ',', ';', '\t', }, System.StringSplitOptions.RemoveEmptyEntries);
foreach(string word in words) {
double value;
if (double.TryParse(word, out value) {
} else {
value = double.NaN;
}
}
Please see:
http://msdn.microsoft.com/en-us/library/ms131448.aspx[
^].
To read a text file, use
System.IO.StreamReader
,
http://msdn.microsoft.com/en-us/library/system.io.streamreader.aspx[
^].
Good luck,
SA