Advertisement
Guest User

Untitled

a guest
Aug 18th, 2017
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.35 KB | None | 0 0
  1. String str = "57mm x 37mm";
  2. str = str.replaceAll("[^-?0-9]+", " ");
  3. System.out.println(Arrays.asList(str.trim().split(" ")));
  4.  
  5. [57, 37]
  6.  
  7. Pattern patron = Pattern.compile("-?\d+");
  8. Matcher resultados = patron.matcher("57mm x 37mm");
  9.  
  10. while (resultados.find())
  11. {
  12. System.out.println(resultados.group());
  13. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement