| | |
| | | |
| | | import java.text.SimpleDateFormat; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | import java.util.regex.Matcher; |
| | | import java.util.regex.Pattern; |
| | | |
| | |
| | | /** |
| | | * 格式化当前系统日期 3 |
| | | */ |
| | | public static final SimpleDateFormat YMD__FORMAT = new SimpleDateFormat("yyyyMMdd_"); |
| | | public static final SimpleDateFormat YMD2_FORMAT = new SimpleDateFormat("yyyyMMdd"); |
| | | |
| | | /** |
| | | * 格式化当前系统日期 4 |
| | | */ |
| | | public static final SimpleDateFormat YMD_HM_FORMAT = new SimpleDateFormat("yyyyMMdd_HHmm"); |
| | | public static final SimpleDateFormat YMDHMS2_FORMAT = new SimpleDateFormat("yyyyMMddHHmmss"); |
| | | |
| | | /** |
| | | * 判断字符串,是否为整数 |
| | |
| | | * 字符串,是否为空null和空格 |
| | | */ |
| | | public static boolean isEmpty(String str) { |
| | | return str == null || "".equals(str.trim()); |
| | | return null == str || "".equals(str.trim()); |
| | | } |
| | | |
| | | /** |
| | |
| | | */ |
| | | public static String getLikeStr(String str) { |
| | | return StringHelper.isEmpty(str) ? null : "%" + str.trim() + "%"; |
| | | } |
| | | |
| | | /** |
| | | * 获取 like 字符串-2 |
| | | */ |
| | | public static String getLikeStr2(String str) { |
| | | return StringHelper.isEmpty(str) ? "%" : "%" + str.trim() + "%"; |
| | | } |
| | | |
| | | /** |
| | |
| | | public static boolean checkPwdValid(String pwd) { |
| | | return Pattern.matches(StaticData.PWD_REG, pwd); |
| | | } |
| | | |
| | | /** |
| | | * 连接List集合 |
| | | * @param list 整数集合 |
| | | * @param join 连接字符 |
| | | * @return |
| | | */ |
| | | public static String join(List<Integer> list, String join) { |
| | | if (null == list || list.isEmpty()) { |
| | | return ""; |
| | | } |
| | | |
| | | StringBuilder sb = new StringBuilder(); |
| | | for (Integer i : list) { |
| | | if (null != i) { |
| | | sb.append(i.toString() + join); |
| | | } |
| | | } |
| | | |
| | | if (sb.length() > 0 && sb.lastIndexOf(join) == sb.length() - 1) { |
| | | sb.deleteCharAt(sb.length() -1 ); |
| | | } |
| | | |
| | | return sb.toString(); |
| | | } |
| | | } |