is Number String by regex: [0-9]+ - Android java.lang

Android examples for java.lang:String Convert

Description

is Number String by regex: [0-9]+

Demo Code

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

public class Main{


    public static boolean isNumberString(String input) {
        if (!isNullOrEmpty(input)) {
            if (input.matches("[0-9]+")) {
                return true;
            }/* w w w  .ja  v  a 2s  .c  o m*/
        }
        return false;
    }

}

Related Tutorials