import java.util.regex.*;

public boolean isNumeric(String str){
   Pattern pattern = Pattern.compile("[0-9]*");
   Matcher isNum = pattern.matcher(str);
   if( !isNum.matches() ){
       return false;
   }
   return true;
}

 

如果傳回true 代表數字

如果傳回false代表文字

arrow
arrow
    全站熱搜

    ROACH 發表在 痞客邦 留言(0) 人氣()