Android String to Int Convert parseIntOrZero(CharSequence charSequence)

Here you can find the source of parseIntOrZero(CharSequence charSequence)

Description

parse Int Or Zero

Declaration

public static int parseIntOrZero(CharSequence charSequence) 

Method Source Code

//package com.java2s;
import android.text.TextUtils;

public class Main {
    public static int parseIntOrZero(CharSequence charSequence) {
        if (!TextUtils.isEmpty(charSequence)) {
            try {
                return Integer.parseInt(charSequence.toString());
            } catch (NumberFormatException ignore) {
            }/*ww w  .  ja  v a 2 s.c  o  m*/
        }
        return 0;
    }
}

Related

  1. parseInt(String str)
  2. parseInt(String arg, int defaultValue)
  3. stringToIntArray(String arrString, String separator)
  4. getIntegerArrayList(String strInput)
  5. validInt(CharSequence integer)
  6. parseInt(String string, int defValue)
  7. convertStringToInt(String str)
  8. convertStringToInt(String str, int failValue)