String classboolean | matches(String regex)
Tells whether or not this string matches the given regular expression.
------------------------------
Boolean bl;
String str = "999y";
bl = matches("[0-9]+");// "[0-9]+" regular expression(正则表达式)
if (bl) {
parseInt("999y")
}
Tells whether or not this string matches the given regular expression.
------------------------------
Boolean bl;
String str = "999y";
bl = matches("[0-9]+");// "[0-9]+" regular expression(正则表达式)
if (bl) {
parseInt("999y")
}
public boolean isNumber(String buf){
for(int i=0; i<buf.length(); i++){
if(buf.charAt(i) < '0' || buf.charAt(i) > '9'){
if(buf.charAt(i) != '.')
return false;
}
}
return true;
}