[英]Remove special character from string?
i have String like 我喜欢String
Join our<\/strong>\u00a0<strong>“Worldwide Host Your Own Screening Tour!
and i want 而且我要
Join our Worldwide Host Your Own Screening Tour!
My Code:: 我的代码::
String str = "Join our<\/strong>\u00a0<strong>“Worldwide Host Your";
System.out.println(str.replaceAll("<\/strong>\u00a0<strong>“", " "));
Error 错误
Invalid escape sequence (valid ones are \b \t \n \f \r \" \' \\ )
Try this: 尝试这个:
String str = "Join our<\\/strong>\u00a0<strong>“Worldwide Host Your";
System.out.println(str.replaceAll("<\\\\/strong>\\u00a0<strong>“", " "));
String.replaceAll
expects an RegEx. String.replaceAll
需要一个RegEx。
You could use StringUtils too (it is a bit simple): 你也可以使用StringUtils (它有点简单):
StringUtils.replace(str, "<\\/strong>\u00a0<strong>“", "")
Try it. 试试吧。
String s="Join our<\\/strong>\u00a0<strong>“Worldwide Host Your Own Screening Tour!";
System.out.println(s.replaceAll("<\\\\/strong>\\u00a0<strong>“", " "));
Francisco wins. Francisco赢了。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.