Write the code to process the list of words and trim any spaces out of the words

后端 未结 2 1952
孤街浪徒
孤街浪徒 2021-01-29 13:13

This code is supposed to check through an array of strings and see if there is a space between a word. Here is an example: {“every”, “near ing”, “ checking”, “food “, “stand”, “

2条回答
  •  故里飘歌
    2021-01-29 13:55

    maby this wil work

       public static String[] removeSpace(String[] ans) {
            for(String s:ans){
                while(s.contains(" ")){
                    s = s.split(" ")[0] + s.split(" ")[1];
                }
            }
            return ans;
        }
    

提交回复
热议问题