StringBuffer sb = new StringBuffer();
for (int i = 0; i < text.length(); i++) {
System.out.println(text.charAt(i));
if(Character.isWhitespace(text.charAt(i)))
{
System.out.println("yes");
sb.append(",");
}else
{
sb.append(text.charAt(i));
}
}
System.out.println(sb.toString());
Java将空格替换为逗号
最新推荐文章于 2023-05-12 15:11:16 发布