regex - Java: Find Lines which start with double slashes "//" -
i'm goint read someline text file. want remove lines starts //. used below syntax find line not working. don't know right regex this. glad if can correct me:
if (line.startswith("//")){ /* related stuff*/ continue; }
line.startswith("//") right way of checking if line starts in 2 forward slashes (demo).
if check same thing using regex, expression "^//.*$", ^ anchor stands beginning of line, $ stands end of line, , .* stands else in between (demo).
Comments
Post a Comment