Hi,
I may get more than 1000 lines in a file. Each line ends with a new line character. Sometimes the file may have 4 lines.
Other lines will have characters such as , : alone.
I'm storing each line in the database if it is a valid line and If the line contains only the above characters (, : ) i need to skip the line and doesn't want to save.
Example Input,
Allows you to work and play in a secure computing environment.
,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
Allows you to play online
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
Lines Saved:
Allows you to work and play in a secure computing environment.
Allows you to play online
Currently what i'm skipping the line if it has the above characters as below
Pattern.compile([,:+ ])
Matcher matcher = pattern.matcher(string);
String tmp = matcher.replaceAll("")
if(tmp.length > 0 ) {
/// Skip
}
Is there is any other way to do instead of calling replaceAll ??
I like to know whether is there is any other way to check whether the string contains only those characters and nothing else, so that i can directly skip
instead of calling replaceAll and checking for length?
any pattern or regular expression which should say the line contains only those characters and nothing else, so we can skip the line.
Please help.
Thanks,
Kathir