java 转义序列与空白字符 (\s)
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/40010404/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Escape Sequence vs. Whitespace Character (\s)
提问by Matthew
Are escape sequences and whitespace characters the same thing? I'm not sure what else to write here but Stackoverflow said the first sentence is not enough so I'm typing this second sentence for no reason at all but that so this post will go through.
转义序列和空格字符是一回事吗?我不知道这里还能写什么,但 Stackoverflow 说第一句话还不够,所以我毫无理由地输入第二句话,但这样这篇文章就会结束。
回答by PNS
There are a few escape sequences specified in Java
, of which \s
is not part. The \s
is recognized as whitespace in regular expressions, where it is a predefined character class.
中指定了一些转义序列Java
,其中\s
不属于。在\s
被认为是空白在正则表达式,它是一个预定义的字符类。
Check the following sections from the Java Tutorial:
检查 Java 教程中的以下部分: