Java Integer Create toInt(String str, int defValue)

Here you can find the source of toInt(String str, int defValue)

Description

to Int

License

LGPL

Declaration

public static int toInt(String str, int defValue) 

Method Source Code

//package com.java2s;
//License from project: LGPL 

public class Main {

    public static int toInt(String str, int defValue) {
        try {/*from  w  ww.java 2 s  .  c om*/
            return Integer.parseInt(str);
        } catch (Exception e) {
        }
        return defValue;
    }

    public static int toInt(String obj) {
        if (obj == null)
            return 0;
        return toInt(obj, 0);
    }
}

Related

  1. toInt(String str)
  2. toInt(String str)
  3. toInt(String str)
  4. toInt(String str, int defaultValue)
  5. toInt(String str, int defaultValue)
  6. toInt(String str, int val)
  7. toInt(String string)
  8. toInt(String string)
  9. ToInt(String string)