/**
     * 判断是否含有特殊字符
     *
     * @param str
     * @return true为包含,false为不包含
     */
    public static boolean isSpecialChar(String str) {
        String regEx = "[ _`~!@#$%^&*()+=|{}':;',\\[\\].<>/?~!@#¥%……&*()——+|{}【】‘;:”“’。,、?]|\n|\r|\t";
        Pattern p = Pattern.compile(regEx);
        Matcher m = p.matcher(str);
        return m.find();
    }
    /**
     * 判断是否以0开头
     *
     * @param code
     * @return true为合法,false为不合法
     */
    public static boolean isZeroBefore(String code){
        String regex="^0\\d*$";
        Pattern p = Pattern.compile(regex);
        Matcher m = p.matcher(code);
        return m.matches();
    }

 

相关文章:

  • 2022-12-23
  • 2021-07-24
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2021-06-29
  • 2022-12-23
  • 2022-12-23
  • 2022-01-08
  • 2022-12-23
相关资源
相似解决方案