Java Integer Create toInt(Object vo)

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

Description

to Int

License

Open Source License

Declaration

public final static int toInt(Object vo) 

Method Source Code

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

public class Main {
    public final static String EMPTY_STR = "";

    public final static int toInt(Object vo) {
        if (vo == null) {
            return 0;
        }/* w  ww.j  ava2 s .c om*/
        String voStr = toString(vo);

        try {
            return Integer.parseInt(voStr);
        } catch (Exception e) {
        }
        return 0;
    }

    public final static String toString(Object vo) {
        if (vo == null) {
            return EMPTY_STR;
        }
        return vo.toString().trim();
    }
}

Related

  1. toInt(Object value)
  2. toInt(Object value)
  3. toInt(Object value)
  4. toInt(Object value, int defaultValue)
  5. toInt(Object value, int nullValue)
  6. toInt(short leftShort, short rightShort)
  7. ToInt(short n1, short n2)
  8. toInt(short s0, short s1)
  9. toInt(short x, short y)