Java replaceall() method: replace all matching strings

replaceAll(String regex,String replacement)

Example

String str = "成功者找方法,";  //定义字符串
str = str.replaceAll(",","失败者找理由");  //替换字符串中的逗号
System.out.println(str);  //输出返回的字符串
The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>