开发者

How to remove particular string from .asp file, using Java?

开发者 https://www.devze.com 2023-03-25 13:01 出处:网络
I\'m currently writing something which is validating our vbscript files. Right at the s开发者_开发技巧tart I wish to remove all lines of code which are comments. I was expecting to be able to use the

I'm currently writing something which is validating our vbscript files. Right at the s开发者_开发技巧tart I wish to remove all lines of code which are comments. I was expecting to be able to use the "'" (comment symbol in vbscript) and '\n'. However, when I write the content of the file to screen, the new lines are not formatting. Does this mean there are actually no new lines in the original vbscript file and if not, how could I remove comments?


first read whole file in string example

then use regex or simply substring for removing extra syntax


How are you parsing the file? Are you also taking the '\r' into consideration when removing the comments? Or maybe you are accidentally removing all newline characters.

I would create some state flags to tell the parser when I was in a comment or not.

0

精彩评论

暂无评论...
验证码 换一张
取 消