Look at a program.
String t = "a| | b| | c| | D ";
string[] temp = t.split ("\\|\\|");
System.out.println (temp.length);
Mainly: what does "\\|\\|" mean?
The beginning is a bit of a monk, then carefully see understand, the original is this:
\ \ will escape to the backslash, the backslash itself is the escape character, all become "\|", in the Escape is |, so \\| is actually "|".
Deeper research: Java escape characters
1. Eight binary escape sequence: \ + 1 to 3 digits 5 digits; Range ' \000 ' ~ ' \377 ': null character
2.Unicode Escape Character: \u + four hexadecimal digits; 0~65535 \u0000: null character
3. Special characters: 3
\ ": Double quotes
\ ': Single quotes
\: Backslash
4. Control characters: 5
\ ' Single quote character
\ Slash backslash character
\ r Carriage Return
\ n Line Change
\f Walk Paper Change page
\ t Horizontal jumps
\b Backspace
The escape of a point:. ==> u002e
Escape of Dollar sign: $ ==> u0024
Escape of the exponentiation symbol: ^ ==> u005e
Escape of opening curly braces: {==> u007b
Escape from left parenthesis: [==> u005b
Escape of the Left parenthesis: (==> u0028
Escape of vertical bar: | ==> u007c
Escape of Right parenthesis: ==> u0029
Escape of the asterisk: * ==> u002a
Escape of the plus sign: + ==> u002b
Escape of question mark:? ==> u003f
Escape of backslash: ==> u005c
So \\| actually can also be written as: \\u007C
The above mentioned is the entire content of this article, I hope you can enjoy.