scanner.skip("(\r\n|[\n\r\u2028\u2029\u0085])?");
can anyone please explain this code... i'm still confusing about this code and how this code works while compiling
scanner.skip("(\r\n|[\n\r\u2028\u2029\u0085])?");
can anyone please explain this code... i'm still confusing about this code and how this code works while compiling
scanner.skip("(\r\n|[\n\r\u2028\u2029\u0085])?");
You can read all the details of predefined character classes:
https://docs.oracle.com/javase/10/docs/api/java/util/regex/Pattern.html
Look for horizontal white space and linebreak matcher.
This code tells scanner to skip unwanted characters in the input ignoring delimiters.
In this case, a set of characters related to new-line handling are skipped:
\r\n
CRLF as in Windows\r
- CR (carriage-return) MacOS line separator\n
- LF (line-feed) Unix line separator\u2028
- Unicode line separator\u2029
- Unicode paragraph separator\u0085
- Unicode next lineExplanation for the string:
\r\n
- a pair of CRLFs like in Windows, or any of the following single characters:
\r
- CR (carriage return) MacOS line separator,
\n
- LF (line feed) Unix line separator,
\u2028
- Unicode line separator,
\u2029
- Unicode paragraph separator,
\u0085
- Unicode next line.