Java 判断是否是数字

int id = 12345689797;
Pattern pattern = Pattern.compile("[0-9]*");
Matcher isNum = pattern.matcher(id);
if( !isNum.matches() ){
  //不是数字
}else{
  //是数字
}

猜你喜欢

转载自blog.csdn.net/qq_39774931/article/details/83503597