gouqizi.lvcha wrote:
I need to process a txt file.
Use a language like Ruby or Python. C++ is for large, hard programs that
lack simpler alternatives.
I want to know how can I ignore the lines beginning with # character.
There maybe some blanks ahead of # character
Scripting languages, like Ruby or Python, typically come with built-in
regular expression modules. (C++ makes you download and install one of
several rather pernicious Regex alternatives, each with a steep learning
curve.)
So if one line of your file were in the variable 'line'...
if line !~ /^\s*#/ then
process(line)
end
The // delimits a regular expression, and the ^\s*# is pronounced "the
beginning of the line followed by any number of any kind of spacing
characters followed by a hatch #.
--
Phlip
http://industrialxp.org/community/bi...UserInterfaces