| | |
| | | } |
| | | |
| | | /** |
| | | * 获取 like 字符串-2 |
| | | * 获取 like 字符串 |
| | | */ |
| | | public static String getLikeStr2(String str) { |
| | | return StringHelper.isEmpty(str) ? "%" : "%" + str.trim() + "%"; |
| | | public static String getLikeUpperStr(String str) { |
| | | return StringHelper.isEmpty(str) ? null : "%" + str.trim().toUpperCase() + "%"; |
| | | } |
| | | |
| | | /** |
| | | * 获取 左like 字符串 |
| | | * 获取 右like 字符串 |
| | | */ |
| | | public static String getLeftLike(String str) { |
| | | public static String getRightLike(String str) { |
| | | return StringHelper.isEmpty(str) ? null : str.trim() + "%"; |
| | | } |
| | | |
| | |
| | | * @return 是/否 |
| | | */ |
| | | public static boolean isSqlInjection(String str) { |
| | | if (null == str) { |
| | | return false; |
| | | } |
| | | |
| | | Matcher m = sqlPattern.matcher(str); |
| | | |
| | | return m.matches(); |
| | |
| | | } |
| | | } |
| | | |
| | | if (sb.length() > 0 && sb.lastIndexOf(join) == sb.length() - 1) { |
| | | sb.deleteCharAt(sb.length() - 1); |
| | | if (sb.length() > 0 && sb.lastIndexOf(join) == sb.length() - join.length()) { |
| | | // 删除从索引 start 开始到 end 之间的字符,即 前包括 后不包括。 |
| | | sb.delete(sb.length() - join.length(), sb.length()); |
| | | } |
| | | |
| | | return sb.toString(); |