w*s 发帖数: 7227 | 1 say i have a txt file
line 1
line 2
# this is comment, no read
# comment 2
line 3
...
i start with
string all_stocks = System.IO.File.ReadAllText(FileName);
char[] delimiters = new char[] { ' ', 'r', 'n' };
string[] each_line = myClass.Split(delimiters,
StringSplitOptions.RemoveEmptyEntries);
how to skip comment lines pls ? | c*********e 发帖数: 16335 | 2 把一行string用#为delimiter分开为一個array ar,如果ar[0].trim().equals("") &&
!ar[1].trim().
equals(""),就是comment line
【在 w*s 的大作中提到】 : say i have a txt file : line 1 : line 2 : # this is comment, no read : # comment 2 : line 3 : ... : i start with : string all_stocks = System.IO.File.ReadAllText(FileName); :
|
|