如何判断一个字符串是否全由数字组成

来源:互联网 发布:淘宝好的手办店 编辑:程序博客网 时间:2024/05/21 07:14
private static boolean isNumber(String str) {if (str.length() == 26) {Pattern pattern = Pattern.compile("[0-9]*");Matcher matcher = pattern.matcher(str);if (matcher.matches()) {return true;}}return false;}


原创粉丝点击