String.split() method uses ".", "\", "|" to split

String str = "a.b.c";
String[] strs = str.split("\\.");
System.out.println(strs.length);

Because under normal circumstances, "." is regarded as a regular expression of any character, plus two backslashes is the meaning of "." itself.

Guess you like

Origin blog.csdn.net/ChangeNone/article/details/112479205