字符串多空格变一个空格

String s="sun     chuan     k";
String newS=s.replaceAll(" +","");

newS="sun chuan k";

你可能感兴趣的:(笔记)