s*****i 发帖数: 650 | 1 String b = "\u000A"; is syntax error.
String b = "\u0009"; is right,
String b = "\u001A"; is right too.
why?
How to input "\u000A" into a variable?
thx |
o***e 发帖数: 30 | 2 "\n"
who cares why, it's very special case.
but there's one paragraph just to explain
this in the java spec if you want to know.
【在 s*****i 的大作中提到】 : String b = "\u000A"; is syntax error. : String b = "\u0009"; is right, : String b = "\u001A"; is right too. : why? : How to input "\u000A" into a variable? : thx
|
s*****i 发帖数: 650 | 3 The problem is you can not input the unicode from
"\u000A"
"\u000B"
"\u000C"
"\u000D"
...
【在 o***e 的大作中提到】 : "\n" : who cares why, it's very special case. : but there's one paragraph just to explain : this in the java spec if you want to know.
|
s*******d 发帖数: 4135 | 4 The answer is here:
http://java.sun.com/docs/books/jls/second_edition/html/lexical.doc.html#231571
【在 s*****i 的大作中提到】 : The problem is you can not input the unicode from : "\u000A" : "\u000B" : "\u000C" : "\u000D" : ...
|
s*******d 发帖数: 4135 | 5 简单说一下
这一行程序:
String s = "\u000A";
java编译器会把它读为(分成2行):
String s = "
";
这样就出现了unclosed string literal的错误了.
【在 s*****i 的大作中提到】 : The problem is you can not input the unicode from : "\u000A" : "\u000B" : "\u000C" : "\u000D" : ...
|
m******t 发帖数: 2416 | 6
If you need something you can generalize and put through a loop,
try this:
String s = new String(new byte[]{10});
Note that's a piece of what-the-hell-is-it-trying-to-do code though.
8-)
【在 s*****i 的大作中提到】 : The problem is you can not input the unicode from : "\u000A" : "\u000B" : "\u000C" : "\u000D" : ...
|