title: How to filter out numbers from a string in java?
body: <p>I have a string of the following form for instance -:</p>
  
  <pre><code>String str = "The game received average review scores of 96.92% and 98/100 for the Xbox 360 version";
  </code></pre>
  
  <p>and I want the output as follows -:</p>
  
  <pre><code>Output = "The game received average review scores of % and / for the Xbox version"
  </code></pre>
  
  <p>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 -:</p>
  
  <pre><code>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 &lt; str.length() ; ++i){
  if(!Character.isDigit(str.charAt(i)))
     newStr += str.charAt(i);
  }
  
  System.out.println(newStr);
  </code></pre>
  
  <p>but this doesn't solve the purpose for me, how to go about solving this problem?</p>