Android Utililty Methods String Parse

List of utility methods to do String Parse

Description

The list of methods to do String Parse are organized into topic(s).

Method

booleanisASCII(String str)
Returns true if the string does not fit in standard ASCII
if (str == null)
    return true;
for (int i = 0; i < str.length(); ++i) {
    char c = str.charAt(i);
    if (c < 0 || c > 0x7f)
        return false;
return true;
...
booleanisAllDigital(String str)
is All Digital
boolean is = true;
if (getCharNum(str, '.') >= 2) {
    return false;
for (int i = 0; i < str.length(); ++i) {
    if ((str.charAt(i) - '0' < 0 || str.charAt(i) - '9' > 0)
            && str.charAt(i) - '.' != 0) {
        is = false;
...
booleanisDecimal(String str)
is Decimal
return Pattern.compile("[\\d]").matcher(str).matches();
booleanisDifferent(String str1, String str2)
is Different
return !equals(str1, str2);
booleanisDigits(Object o)
is Digits
if (o == null) {
    return false;
String s = o.toString();
if (s.length() == 0)
    return false;
int i = (s.charAt(0) == '-') ? 1 : 0;
for (int j = s.length(); i < j; i++) {
...
booleanisDigits(String s)
is Digits
if (s == null || s.length() == 0)
    return false;
int begin = (s.charAt(0) == '-') ? 1 : 0;
for (int i = begin; i < s.length(); i++) {
    if (!Character.isDigit(s.charAt(i)))
        return false;
return true;
...
booleanisDouble(String str)
is Double
Pattern pattern = Pattern.compile("^[-\\+]?[.\\d]*$");
return pattern.matcher(str).matches();
booleanisIDCard(String str)
is ID Card
int length = str.length();
return isNumber(str) && (length == 15 || length == 18);
booleanisInteger(String input)
is Integer
try {
    Integer.parseInt(input);
    return true;
} catch (Exception e) {
    return false;
booleanisInteger(String str)
is Integer
Pattern pattern = Pattern.compile("^[-\\+]?[\\d]*$");
return pattern.matcher(str).matches();