Android examples for java.util.regex:Numeric Pattern
is string all Numeric by regular expression
import java.io.PrintWriter; import java.io.StringWriter; import java.io.Writer; import java.util.regex.Matcher; import java.util.regex.Pattern; public class Main{ public static boolean isNumeric(String str) { boolean isMatches = false; Pattern pattern = Pattern.compile("[0-9]*"); Matcher isNum = pattern.matcher(str); if (isNum.matches()) { isMatches = true;//from ww w.ja v a2s. c o m } return isMatches; } }