当前位置:主页 > 软件编程 > JAVA代码 >

java判断字符串是正整数的实例

时间:2022-03-10 20:57:38 | 栏目:JAVA代码 | 点击:

实例如下所示:

public static boolean isPureDigital(String string) {
    if (isBlank(string))
      return false;
    String regEx1 = "\\d+";
    Pattern p;
    Matcher m;
    p = Pattern.compile(regEx1);
    m = p.matcher(string);
    if (m.matches())
      return true;
    else
      return false;
  }

您可能感兴趣的文章:

相关文章