fork(1) download
  1. /* package whatever; // don't place package name! */
  2.  
  3. import java.util.*;
  4. import java.lang.*;
  5. import java.io.*;
  6.  
  7. /* Name of the class has to be "Main" only if the class is public. */
  8. class Ideone
  9. {
  10. public static void main (String[] args) throws java.lang.Exception
  11. {
  12. String recognizedText = "asd 232 sdfsdf3234 wersdfsf3r4 986";
  13.  
  14. recognizedText = recognizedText.replaceAll("[^0-9]+", " "); //Replaces all except numbers from 0 to 9
  15.  
  16. System.out.println (recognizedText);
  17.  
  18. String[] justnumbers = recognizedText.trim().split(" "); //Deletes blank spaces and splits the numbers
  19. //YourTextView.setText(Arrays.toString(justnumbers).replaceAll("\\[|\\]", "")) //sets the numbers into the TextView and deletes the "[]" from the String Array
  20.  
  21. System.out.println (Arrays.toString(justnumbers).replaceAll("\\[|\\]", ""));
  22. }
  23. }
Success #stdin #stdout 0.13s 320576KB
stdin
Standard input is empty
stdout
 232 3234 3 4 986
232, 3234, 3, 4, 986