daily pastebin goal
45%
SHARE
TWEET

Untitled

a guest Jan 22nd, 2019 68 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  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);
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top