public String removeNumbersInString(String str) {
String temp = "";
String regexp = "^[0-9]";
Pattern pattern = Pattern.compile(regexp);
Matcher matcher;
if(!str.isEmpty()){
for (int i = 0; i < str.length(); i++) {
matcher = pattern.matcher(str.charAt(i) + "");
if (!matcher.matches()) {
temp = temp + str.charAt(i) + "";
}
}}
System.out.println("" + temp);
return temp;
}
No comments:
Post a Comment
Please post your comments. Your comments make us to write more programs for you.