android:判断字符串是否全是数字

2022-02-16  本文已影响0人  hao_developer
public boolean isNumeric(String str){ 
   Pattern pattern = Pattern.compile("[0-9]*"); 
   Matcher isNum = pattern.matcher(str);
   if( !isNum.matches() ){
       return false; 
   } 
   return true; 
}

上一篇 下一篇

猜你喜欢

热点阅读