英文:
A problem about the code in java especially in skip function
问题
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
答案1
得分: 1
scanner.skip("(\r\n|[\n\r\u2028\u2029\u0085])?");
你可以阅读预定义字符类的所有详细信息:
https://docs.oracle.com/javase/10/docs/api/java/util/regex/Pattern.html
查找水平空白和换行匹配器。
英文:
  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.
答案2
得分: 0
这段代码告诉扫描器在输入中跳过不需要的字符,忽略分隔符。
在这种情况下,一组与换行处理相关的字符会被跳过:
- 一对 
\r\nCRLF,如Windows中所示 - 或以下任何单个字符:
\r- CR(回车)MacOS换行分隔符\n- LF(换行)Unix换行分隔符\u2028- Unicode换行分隔符\u2029- Unicode段落分隔符\u0085- Unicode下一行
 
英文:
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:
- a pair of 
\r\nCRLF as 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
 
答案3
得分: 0
Explanation for the string:
\r\n - 一对CRLF,类似于Windows中的换行符,
\r - CR(回车)MacOS换行符,
\n - LF(换行)Unix换行符,
\u2028 - Unicode换行符,
\u2029 - Unicode段落分隔符,
\u0085 - Unicode下一行。
英文:
Explanation 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.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。


评论