由买买提看人间百态

boards

本页内容为未名空间相应帖子的节选和存档,一周内的贴子最多显示50字,超过一周显示500字 访问原贴
DotNet版 - How not to read comment lines from a text file
相关主题
a question about C++.net class librarySurvey: Any company plan to use Azure soon?
[合集] 问一个Response.WriteFile的问题网页上读者comment有必要存在server side吗?
C#的new在method declaration里有和没有有啥区别么如何用ajax实现comments update
包子题: Implement GetFullPathOfIsolatedFilehow to coding for draw text lines ?
Windows filesystem bug不看不知道
How to use openFileDialog() to save a binary file in .net C++工程师们看过来
WebClient is not thread-safe!用Python读csv文件header?
LinqPad is handyhow to find a file in unix
相关话题的讨论汇总
话题: comment话题: line话题: delimiters话题: lines话题: read
进入DotNet版参与讨论
1 (共1页)
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);
:

1 (共1页)
进入DotNet版参与讨论
相关主题
how to find a file in unixWindows filesystem bug
问10个老题How to use openFileDialog() to save a binary file in .net C++
如何实现 strtok() ?WebClient is not thread-safe!
这个有更好的算法吗?LinqPad is handy
a question about C++.net class librarySurvey: Any company plan to use Azure soon?
[合集] 问一个Response.WriteFile的问题网页上读者comment有必要存在server side吗?
C#的new在method declaration里有和没有有啥区别么如何用ajax实现comments update
包子题: Implement GetFullPathOfIsolatedFilehow to coding for draw text lines ?
相关话题的讨论汇总
话题: comment话题: line话题: delimiters话题: lines话题: read