首页 > 代码库 > PatternSyntaxException:Syntax error in regexp pattern
PatternSyntaxException:Syntax error in regexp pattern
Caused by: java.util.regex.PatternSyntaxException: Syntax error in regexp pattern near index 1:
E/AndroidRuntime(17429): }
E/AndroidRuntime(17429): ^
E/AndroidRuntime(17429): at java.util.regex.Pattern.compileImpl(Native Method)
E/AndroidRuntime(17429): at java.util.regex.Pattern.compile(Pattern.java:400)
E/AndroidRuntime(17429): at java.util.regex.Pattern.<init>(Pattern.java:383)
E/AndroidRuntime(17429): at java.util.regex.Pattern.compile(Pattern.java:374)
E/AndroidRuntime(17429): at java.lang.String.split(String.java:1842)
E/AndroidRuntime(17429): at java.lang.String.split(String.java:1823)
E/AndroidRuntime(17429): atcom.tang.weather.WeatherMainActivity.onCreate(WeatherMainActivity.java:54)
E/AndroidRuntime(17429): at android.app.Activity.performCreate(Activity.java:5046)
E/AndroidRuntime(17429): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1079)
E/AndroidRuntime(17429): }
E/AndroidRuntime(17429): ^
E/AndroidRuntime(17429): at java.util.regex.Pattern.compileImpl(Native Method)
E/AndroidRuntime(17429): at java.util.regex.Pattern.compile(Pattern.java:400)
E/AndroidRuntime(17429): at java.util.regex.Pattern.<init>(Pattern.java:383)
E/AndroidRuntime(17429): at java.util.regex.Pattern.compile(Pattern.java:374)
E/AndroidRuntime(17429): at java.lang.String.split(String.java:1842)
E/AndroidRuntime(17429): at java.lang.String.split(String.java:1823)
E/AndroidRuntime(17429): atcom.tang.weather.WeatherMainActivity.onCreate(WeatherMainActivity.java:54)
E/AndroidRuntime(17429): at android.app.Activity.performCreate(Activity.java:5046)
E/AndroidRuntime(17429): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1079)
E/AndroidRuntime(17429): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2037)
代码: temp =temp.split("}")[1];出错
“{” 是关键字符,要加上转意字符
temp =temp.split("\\}")[1];
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。