public static void isAC(String hex) { String regex = "^[A-Fa-f0-9]{28}|[A-Fa-f0-9]{34}$"; if (hex.matches(regex)) { System.out.println(hex.toUpperCase()+"是28位或者34位16进制数"); } else { System.out.println(hex.toUpperCase()+"不是28位或者34位16进制数"); throw new RuntimeException("the ac String is error"); } }
正则十六进制
最新推荐文章于 2024-10-16 10:28:15 发布