Android String to Int Convert validInt(CharSequence integer)

Here you can find the source of validInt(CharSequence integer)

Description

valid Int

Declaration

public static boolean validInt(CharSequence integer) 

Method Source Code

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

public class Main {
    public static boolean validInt(CharSequence integer) {
        if (!TextUtils.isEmpty(integer)) {
            try {
                Integer.parseInt(integer.toString());
                return true;
            } catch (NumberFormatException ex) {
            }//w  ww  . j  a v  a  2  s. c o  m
        }
        return false;
    }
}

Related

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