/N press enter (/u000a) <br/>/T horizontal tab (/u0009) <br/>/B space (/u0008) <br/>/R line feed (/u000d) <br/>/F form feed (/u000c) <br/>/'single quotation marks (/u0027) <br/>/"Double quotation marks (/u0022) <br/> // backslash (/u005c) <br/>/DDD three-digit octal <br/>/udddd 4-digit hexadecimal <br/>
Other characters to be escaped, such
String sname = "Java escape character (Addendum)"; <br/> sname = sname. replacefirst ("(Addendum)", ""); <br/> out. println (sname); <br/>
If you think it will output "Java escape characters", you will be wrong. In fact, the output of "Java escape characters ()" is also very strange. I thought it was a question of Chinese and English parentheses, but no. I'm not sure whether to escape the problem. The solution is
Sname = sname. replacefirst ("// (Addendum //)", ""); </P> <p> sname = sname. replacefirst ("(Addendum)", ""); <br/>
"(Addendum)" is considered a regular expression, rather than a normal string (). In a regular expression, it is used to mark a substring. $1 can be used, $2 and so on to obtain the matching string "// (Addendum //)" first, the string actually represented in Java "/(addendum /) "Then the string is a/Escape Character in the regular expression.