判断输入的字符串是否为数字

    /**
     * 判断字符串是否是数字
     * */
    public boolean isNumber(String userInput)
    {
        Pattern pattern = Pattern.compile("[0-9]*");
        return pattern.matcher(userInput).matches();
    }
 

你可能感兴趣的:(字符串)