is string all Number by ASCII code - Android java.lang

Android examples for java.lang:String

Description

is string all Number by ASCII code

Demo Code

import android.text.TextUtils;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

public class Main{

    public static boolean isNumber(String validString) {
        byte tempbyte[] = validString.getBytes();
        for (int i = 0; i < validString.length(); i++) {
            if (tempbyte[i] < 48 || tempbyte[i] > 57) {
                return false;
            }/*  w  ww. ja v  a  2s  .  c o m*/
        }
        return true;
    }

}

Related Tutorials