split切割多个空格

    public static void main(String[] args) {
        String s ="123   456 abc         789";
        String[] split = s.split(" +");
        for (int i = 0; i < split.length; i++) {
            System.out.print(split[i]);//123456abc789
        }
    }

 

 
posted @ 2020-10-14 00:07  SimonShixinlong  阅读(1929)  评论(0)    收藏  举报