将字符串重复的字符替换成单个字符的正则表达式
eg:
String a = ",,,你好,,,,你好,,,,,,你好,,我好,好好,暗示的发生夺,";
a = a.replaceAll("[,]+", ",");//替换字符,
System.out.println(a);
将字符串重复的字符替换成单个字符的正则表达式
eg:
String a = ",,,你好,,,,你好,,,,,,你好,,我好,好好,暗示的发生夺,";
a = a.replaceAll("[,]+", ",");//替换字符,
System.out.println(a);
本文标题:java将字符串重复的字符替换成单个字符的正则表达式
本文链接:https://www.haomeiwen.com/subject/sbvgkctx.html
网友评论