Java Integer Create toInteger(String value)

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

Description

to Integer

License

Open Source License

Declaration

public static Integer toInteger(String value) 

Method Source Code

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

public class Main {
    public static Integer toInteger(String value) {

        Integer integer = null;/*from w  w w. j ava2  s.  co m*/
        try {
            integer = Integer.parseInt(value);
        } catch (Exception e) {
            integer = null;
        }

        return integer;
    }

    public static int parseInt(String intString, int defaultValue) {

        int parsedInt = defaultValue;

        try {
            parsedInt = Integer.parseInt(intString);
        } catch (Exception e) {
            parsedInt = defaultValue;
        }

        return parsedInt;
    }
}

Related

  1. toInteger(String string, Integer deff)
  2. toInteger(String val)
  3. toInteger(String value)
  4. toInteger(String value)
  5. toInteger(String value)
  6. toInteger(String value, int _default)
  7. toInteger(String value, int defaultValue)
  8. toInteger(String value, int defaultValue)
  9. toInteger(String value, Integer defValue)