###1.事務要慎用java
###2.關於特殊字符的處理mysql
// 普通字符, 數字字母空格反斜槓 String s6 = "ZHA/NG SAN"; System.out.println(Pattern.compile("[0-9a-zA-Z_ /]+").matcher(s6).matches()); System.out.println(Pattern.compile("([0-9a-zA-Z_]|[ /])+").matcher(s6).matches()); // 普通字符, 數字字母下劃線 String s = "123abcAZY_"; System.out.println(Pattern.compile("\\w+").matcher(s).matches()); System.out.println(Pattern.compile("[0-9a-zA-Z_]+").matcher(s).matches()); // 非普通字符 String s2 = "@$%^中國"; System.out.println(Pattern.compile("\\W+").matcher(s2).matches()); System.out.println(Pattern.compile("[^0-9a-zA-Z_]+").matcher(s2).matches()); // 中文字符, 不包括標點 String s3 = "中國"; System.out.println(Pattern.compile("[\\u4e00-\\u9fa5]+").matcher(s3).matches()); // 其它特殊字符 String s4 = "\u00b7\u3002\uff0c\uff0e"; // ·。,. System.out.println(Pattern.compile("[^0-9a-zA-Z_\\u4e00-\\u9fa5]+").matcher(s4).matches()); // 半角字符, 其中·是半角標點 String s5 = "123abcAZY_?!@#!@·¹¸";// System.out.println(Pattern.compile("[\\x00-\\xff]+").matcher(s5).matches());
正常性況下, 空值判斷有以下幾種狀況sql
java 語言判斷方法apache
System.out.println("".length()); System.out.println(" ".length()); System.out.println(" ".trim().length()); System.out.println("\b\b".trim().length()); System.out.println("\b\t".trim().length()); org.apache.commons.lang3.StringUtils.isBlank(""); org.apache.commons.lang3.StringUtils.isEmpty("");
select nvl(null, '') from dual; select length(' ') from dual; select * from dcs_h where ' ' = ' ' and rownum < 2;
select ifnull(null, ''); select length(' '); select * from dcs_h where '' = ' ' limit 1;
select isnull(null, 1); select len(' '); select top 1 * from dcs_h where '' = ' ';