is Start Zero Numeric - Android java.lang

Android examples for java.lang:String

Description

is Start Zero Numeric

Demo Code

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

public class Main{


    public static boolean isStartZeroNumeric(String str) {
        String newStr = trim(str);
        Pattern pattern = Pattern.compile("^0\\d*$");
        Matcher isNum = pattern.matcher(newStr);
        if (isNum.matches()) {
            return true;
        }//  w ww  .  ja v a  2  s  .  com
        return false;
    }

}

Related Tutorials