Java Integer Create toInt(String value, Integer fallback)

Here you can find the source of toInt(String value, Integer fallback)

Description

to Int

License

Open Source License

Declaration

public static Integer toInt(String value, Integer fallback) 

Method Source Code

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

public class Main {
    public static Integer toInt(String value, Integer fallback) {

        if (value == null || value.isEmpty()) {
            return fallback;
        }/*from   w  w w.  j ava  2 s  .  c  o m*/

        try {
            return Integer.valueOf(value);
        } catch (Exception e) {
            return fallback;
        }
    }
}

Related

  1. toInt(String value, int defaultValue)
  2. toInt(String value, int defaultValue)
  3. toInt(String value, int defaultValue)
  4. toInt(String value, Integer defaultValue)
  5. toInt(String value, Integer defaultValue)
  6. toInt(String[] a, int off, int len)
  7. toInt(String[] s)
  8. toInt(String[] s, int i)
  9. toInt(T value)