私はコア Java コンセプトを使用して、この問題を乗り切りました。
/**
* removeSpecialCharacters
* @param number
* @return
*/
private String removeSpecialCharacters(String number) {
String filterNum = number;
if(filterNum.contains("-")){
filterNum = filterNum.replace("-", "");
}
if(filterNum.contains("(")){
filterNum = filterNum.replace("(", "");
}
if(filterNum.contains(")")){
filterNum = filterNum.replace(")", "");
}
if(filterNum.contains(".")){
filterNum = filterNum.replace(".", "");
}
if(filterNum.contains("/")){
filterNum = filterNum.replace("/", "");
}
if(filterNum.contains(",")){
filterNum = filterNum.replace(",", "");
}
if(filterNum.contains("#")){
filterNum = filterNum.replace("#", "");
}
if(filterNum.contains("*")){
filterNum = filterNum.replace("*", "");
}
if(filterNum.contains("+")){
filterNum = filterNum.replace("+", "");
}
if(filterNum.contains("N")){
filterNum = filterNum.replace("N", "");
}
if(filterNum.contains(";")){
filterNum = filterNum.replace(";", "");
}
if(filterNum.contains("%")){
filterNum = filterNum.replace("%", "");
}
if(filterNum.contains(" ")){
filterNum = filterNum.replace(" ", "");
}
if(filterNum.contains("@")){
filterNum = filterNum.replace("@", "");
}
if(filterNum.contains("$")){
filterNum = filterNum.replace("$", "");
}
if(filterNum.contains("^")){
filterNum = filterNum.replace("^", "");
}
if(filterNum.contains("&")){
filterNum = filterNum.replace("&", "");
}
if(filterNum.contains("_")){
filterNum = filterNum.replace("_", "");
}
if(filterNum.contains("=")){
filterNum = filterNum.replace("=", "");
}
if(filterNum.contains("~")){
filterNum = filterNum.replace("~", "");
}
if(filterNum.contains("`")){
filterNum = filterNum.replace(";", "");
}
return filterNum;
}