package com.goafanti.common.utils; import java.util.Map; import java.util.regex.Pattern; public class StringUtils extends org.apache.commons.lang3.StringUtils { private static Pattern FRACTIONAL_NUMERIC = Pattern.compile("^[\\-+]?\\d+(\\.\\d+)?$"); private static Pattern CHINESE_CODE=Pattern.compile("[\u4e00-\u9fa5]"); public static boolean isFractionalNumeric(String val) { return FRACTIONAL_NUMERIC.matcher(val).matches(); } public static boolean isNull(Object value) { return value == null; } /** * * 判断一个对象是否非空 * * @param object Object * @return true:非空 false:空 */ public static boolean isNotNull(Object object) { return !isNull(object); } /** * * 判断一个Map是否为空 * * @param map 要判断的Map * @return true:非空 false:空 */ public static boolean isNotEmpty(Map map) { return !isEmpty(map); } /** * * 判断一个Map是否为空 * * @param map 要判断的Map * @return true:为空 false:非空 */ public static boolean isEmpty(Map map) { return isNull(map) || map.isEmpty(); } /** * * 判断一个对象数组是否为空 * * @param objects 要判断的对象数组 ** @return true:为空 false:非空 */ public static boolean isEmpty(Object[] objects) { return isNull(objects) || (objects.length == 0); } public static boolean isContainChinese(String str){ if (CHINESE_CODE.matcher(str).find()){ return true; } return false; } public static void main(String[] args) { System.out.println(isContainChinese("91430100060111212G")); } }