I have a string of the following form for instance -:
String str = "The game received average review scores of 96.92% and 98/100 for the Xbox 360 version";
and I want the output as follows -:
Output = "The game received average review scores of % and / for the Xbox version"
and I want to be able to filter out any number that's there in the string whether its a decimal or a floating point number, I tried using a brute force way of doing this like this -:
String str = "The game received average review scores of 96.92% and 98/100 for the Xbox 360 version";
String newStr = "";
for(int i = 0 ; i < str.length() ; ++i){
if(!Character.isDigit(str.charAt(i)))
newStr += str.charAt(i);
}
System.out.println(newStr);
but this doesn't solve the purpose for me, how to go about solving this problem?