原String为:Hello! Game programming world!
System.out.println(before.replaceAll("^\s{1,}$"," "));---(1)
System.out.println(before.replaceAll("\s{1,}"," "));---(2)
执行的结果为:
Hello! Game programming world!
Hello! Game programming world!
为什么第(1)种方法没有能够实现去掉多余的空格呢?这两种写法有什么区别呢?