W
Wendy S
I'm trying to split a large text file whenever there is a certain character
(ASCII 12)
The suggested code is not compiling:
[javac]
G:\irm\sharedsource\ColleagueWeb\coldev\src\java\edu\asu\vpia\webapp
\PDFServlet.java:190: illegal escape character
[javac] String[] reportPage = report.split( "\x0c" );
[javac] 1 error
The javadoc for String.split() sends you to java.util.regex.Pattern which
says:
\xhh The character with hexadecimal value 0xhh
So it seems like /x0c should work, but obviously not. I changed it to:
String[] reportPage = report.split( "\u000c" );
which compiles, at least.
Can someone comment on what's wrong with the first syntax, and whether my
replacement is, in fact, equivalent?
(ASCII 12)
The suggested code is not compiling:
[javac]
G:\irm\sharedsource\ColleagueWeb\coldev\src\java\edu\asu\vpia\webapp
\PDFServlet.java:190: illegal escape character
[javac] String[] reportPage = report.split( "\x0c" );
[javac] 1 error
The javadoc for String.split() sends you to java.util.regex.Pattern which
says:
\xhh The character with hexadecimal value 0xhh
So it seems like /x0c should work, but obviously not. I changed it to:
String[] reportPage = report.split( "\u000c" );
which compiles, at least.
Can someone comment on what's wrong with the first syntax, and whether my
replacement is, in fact, equivalent?