// str里是不规则的空格隔开的数据体;如: 10 23 -34 32; 输出结果为: 10 23 -34 32 System.out.println(str.trim().replaceAll("\\s{1,}", " "));