Android examples for java.lang:Integer
is Number String by regular expressions: [0-9]*
import java.util.regex.Matcher; import java.util.regex.Pattern; public class Main{ public static int isNumString(String str) { Pattern p = Pattern.compile("[0-9]*"); Matcher m = p.matcher(str); if (m.matches()) { return 1; } else {//from w ww . ja va 2 s . co m return 0; } } }