| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455 |
- package com.aoyang.tms.util;
- import org.apache.commons.lang3.StringUtils;
- import java.util.regex.Matcher;
- import java.util.regex.Pattern;
- import static java.util.regex.Pattern.compile;
- /**
- * @Description: 输入项校验
- * @Author guoyong
- * @Date 2020/10/21 14:37
- * @Version 1.0
- */
- public class InputCheckUtils {
- /**
- * @Author guoyong
- * @Description 判断是否数字和字符组合
- * @Date 2020/10/21
- * @Param
- * @return
- **/
- public static boolean isLetterDigit(String str) {
- String regex = "^[a-z0-9A-Z]+$";
- return str.matches(regex);
- }
- /**
- * 是否是数字或小数
- * @tags @return
- * @exception
- * @author wanghc
- * @date 2015-9-16 下午5:50:15
- * @return boolean
- */
- public static boolean isNumber(String str){
- if(StringUtils.isBlank(str)){
- return false;
- }
- String reg = "\\d+(\\.\\d+)?";
- return str.matches(reg);
- }
- public static boolean isCarNo(String carNo){
- Pattern p = compile("^[京津沪渝冀豫云辽黑湘皖鲁新苏浙赣鄂桂甘晋蒙陕吉闽贵粤青藏川宁琼使领A-Z]{1}[A-Z]{1}(?:(?![A-Z]{4})[A-Z0-9]){4}[A-Z0-9挂学警港澳]{1}$");
- Matcher m = p.matcher(carNo);
- if (!m.matches()){
- return false;
- }
- return true;
- }
- }
|