Remove all non alphabetic characters from a String array in java

后端 未结 8 969
难免孤独
难免孤独 2020-12-14 08:11

I\'m trying to write a method that removes all non alphabetic characters from a Java String[] and then convert the String to an lower case string. I\'ve tried u

8条回答
  •  感动是毒
    2020-12-14 08:44

    You must reassign the result of toLowerCase() and replaceAll() back to line[i], since Java String is immutable (its internal value never changes, and the methods in String class will return a new String object instead of modifying the String object).

提交回复
热议问题