Java String to Int convertStringToInteger(String value)

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

Description

convert String To Integer

License

Open Source License

Declaration

public static int convertStringToInteger(String value) 

Method Source Code

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

public class Main {
    public static int convertStringToInteger(String value) {
        return convertStringToInteger(value, -1);
    }/*from  w w  w.j  a  v  a  2  s . com*/

    public static int convertStringToInteger(String value, int fallback) {
        try {
            return Integer.parseInt(value);
        } catch (NumberFormatException e) {
            return fallback;
        }
    }
}

Related

  1. convertStringToInteger(String s)
  2. convertStringToInteger(String string)
  3. convertStringToInteger(String strParaConvert)
  4. convertStringToInteger(String value)
  5. convertStringToInteger(String value)