Java字符串替换,
分享于 点击 19414 次 点评:261
Java字符串替换,
public class TestGroup {public static void main(String[] args) {
// -----将字符串“我我....我...要.要...要要...要学....学学..学.编..编编.编.程.程.程..程"还原成我要学编程
String s="我我....我...要.要...要要...要学....学学..学.编..编编.编.程.程.程..程";
String s2=s.replaceAll("\\.", "");
System.out.println(s2);
String s3=s2.replaceAll("(.)\\1+", "$1");
System.out.println(s3);
}
}
相关文章
- 暂无相关文章
用户点评