Android String to Int Convert toInt(Object obj)

Here you can find the source of toInt(Object obj)

Description

to Int

Declaration

public static int toInt(Object obj) 

Method Source Code

//package com.java2s;

public class Main {

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

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

Related

  1. isNumber(String str)
  2. isNumber(String str)
  3. isNumber(final String s)
  4. isNumberString(String input)
  5. isNumberic(String str)
  6. toInt(String obj)
  7. toInt(String str, int defValue)
  8. toInt(String str, int defValue)
  9. toInteger(String value)