Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- String str = "57mm x 37mm";
- str = str.replaceAll("[^-?0-9]+", " ");
- System.out.println(Arrays.asList(str.trim().split(" ")));
- [57, 37]
- Pattern patron = Pattern.compile("-?\d+");
- Matcher resultados = patron.matcher("57mm x 37mm");
- while (resultados.find())
- {
- System.out.println(resultados.group());
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement