개발/기타2018. 9. 17. 10:34



1.

String clean1 = string1.replaceAll("[^0-9]", "");


2.

String clean2 = string2.replaceAll("[^\\d]", "");


3.

String clean3 = string1.replaceAll("\\D", "");


출처 : http://stackoverflow.com/questions/6883579/java-regular-expression-removing-everything-but-numbers-from-string


+) 숫자와 . 만

String clean1 = string1.replaceAll("[^0-9.]", "");




Posted by dnsdud