Guest User

Untitled

a guest
Jan 22nd, 2019
93
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.66 KB | None | 0 0
  1. Integer.parseInt(s.replaceAll("[\D]", ""))
  2.  
  3. s.matches("[\d]+[A-Za-z]?")
  4.  
  5. ((Number)NumberFormat.getInstance().parse("123e")).intValue()
  6.  
  7. Scanner s = new Scanner(MyString);
  8. s.nextInt();
  9.  
  10. int res = 0;
  11. for (int i=0; i < str.length(); i++) {
  12. char c = s.charAt(i);
  13. if (c < '0' || c > '9') continue;
  14. res = res * 10 + (c - '0');
  15. }
  16.  
  17. String something = "423e";
  18. int length = something.length();
  19. String result = "";
  20. for (int i = 0; i < length; i++) {
  21. Character character = something.charAt(i);
  22. if (Character.isDigit(character)) {
  23. result += character;
  24. }
  25. }
  26. System.out.println("result is: " + result);
Add Comment
Please, Sign In to add comment