public static void main(String[] args) {
String s = "I+Love";
s.split("+");
}
Run Code Online (Sandbox Code Playgroud)
这是在线程"main"中抛出异常java.util.regex.PatternSyntaxException:
你需要逃避+特殊的角色:
s.split("\\+"); // split accepts a regular expression and `+` is a metacharacter
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
76 次 |
| 最近记录: |