Java String to Int asInt(String str)

Here you can find the source of asInt(String str)

Description

as Int

License

Open Source License

Declaration

protected static int asInt(String str) 

Method Source Code

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

public class Main {
    protected static int asInt(String str) {
        if (str != null && str.length() > 0)
            try {
                return Integer.parseInt(str.trim());
            } catch (Exception e) {
            }/*from   w ww .j  av  a 2  s .c  o m*/
        return 0;
    }
}

Related

  1. asInt(String number)
  2. asInt(String str)
  3. asInt(String str, int defaultValue)
  4. asInt(String sval, int dflt)
  5. asInt(String value)