java Java中各种类型的空格是什么意思?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/2461647/
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
What the meaning of various types of white space in Java?
提问by Praveen
What is difference of below escape sequences for white space?
下面的空白转义序列有什么区别?
\t, \n, \x0B, \f and \r.
\t、\n、\x0B、\f 和 \r。
采纳答案by bmargulies
Looks like you left out the operators, but I'm interpreting you to want to know how various Java APIs handle those characters.
看起来您遗漏了运算符,但我将您解释为想知道各种 Java API 如何处理这些字符。
The Java handling of these characters is determined by their Unicode character properties. See the Unicode spec to see what properties they have, and thus what the different functions in Character return for them.
Java 对这些字符的处理由它们的 Unicode 字符属性决定。请参阅 Unicode 规范以了解它们具有哪些属性,以及 Character 中的不同函数为它们返回的内容。
www.unicode.org will tell you all you ever wanted to know about Unicode properties.
www.unicode.org 将告诉您所有您想知道的有关 Unicode 属性的信息。
回答by b.roth
\tThe tab character (\u0009)\nThe newline (line feed) character (\u000A)\rThe carriage-return character (\u000D)\fThe form-feed character (\u000C)\x0BThe vertical tabulation (VT) character
\t制表符 (\u0009)\n换行(换行)字符 (\u000A)\r回车符 (\u000D)\f换页符 (\u000C)\x0B垂直制表 (VT) 字符
回答by codaddict
\t - Horizontal tab
\n - New line
\x0B - Vertical tab
\f - form feed
\r - carriage return

