Remove all non alphabetic characters from a String array in java

后端 未结 8 919
难免孤独
难免孤独 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:41

    As it already answered , just thought of sharing one more way that was not mentioned here >

     str = str.replaceAll("\\P{Alnum}", "").toLowerCase();
    

提交回复
热议问题