如何从文本文件中删除具有前面符号的文字?检测到符号后删除文字
例如:
This is important information... //but this is a comment
This is more important info... //and this is another comment
如何删除的话用符号一起“//但是这是一条评论”?
这里是我的伪代码:
1. If "//" is detected, line.replace "//" symbol
2. Clear the words after the symbol
3. Go on to the next line till you see "//" symbol
4. Repeat steps 1-3 (loop).
注意:当文件被读出这是发生:
String line;
while ((line = textReader.readLine()) != null)
这是一些艰难的正则表达式工作。 – Sid 2011-05-25 22:16:57