Java Integer Create toInt(String str)

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

Description

to Int

License

Apache License

Declaration

public static int toInt(String str) 

Method Source Code

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

public class Main {

    public static int toInt(String str) {
        if (str != null && !str.equals("")) {
            int value1;
            try {
                value1 = Integer.parseInt(str);
            } catch (Exception var3) {
                var3.printStackTrace();
                value1 = 0;/*from   w w w . j  av a2s  .c  o  m*/
            }

            return value1;
        } else {
            return 0;
        }
    }

    public static boolean equals(String str1, String str2) {
        return str1 != null && !str1.equals("") && str2 != null && !str2.equals("") ? str1.equals(str2) : false;
    }
}

Related

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