Java Integer Create toInteger(String numeric)

Here you can find the source of toInteger(String numeric)

Description

to Integer

License

Open Source License

Declaration

public static int toInteger(String numeric) 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

public class Main {
    public static int toInteger(String numeric) {
        return (isNumeric(numeric)) ? Integer.parseInt(numeric) : 0;
    }/*from   w  ww.ja v a 2  s  .c  om*/

    public static boolean isNumeric(String string) {
        return string.matches("[+-]?[0-9]+");
    }
}

Related

  1. toInteger(Object value)
  2. toInteger(Object value, int defaultValue)
  3. toInteger(Object x)
  4. toInteger(String ascii)
  5. toInteger(String integer)
  6. toInteger(String numericString)
  7. toInteger(String pString)
  8. ToInteger(String s)
  9. toInteger(String s)