public static void TestStr(){
System.out.println(StringUtils.isEmpty(null));
System.out.println(StringUtils.isNotEmpty(null));
System.out.println(StringUtils.isBlank(" "));
System.out.println(StringUtils.isNotBlank(null));
System.out.println(StringUtils.trim(null));
System.out.println(StringUtils.trimToNull(""));
System.out.println(StringUtils.trimToEmpty(null));
System.out.println(StringUtils.strip("大家好 啊 \t"));
System.out.println(StringUtils.stripToNull(" \t"));
System.out.println(StringUtils.stripToEmpty(null));
System.out.println(StringUtils.defaultString(null));
System.out.println(StringUtils.defaultString("", "df"));
System.out.println(StringUtils.defaultIfEmpty(null, "sos"));
System.out.println(StringUtils.strip("fsfsdf", "f"));
System.out.println(StringUtils.stripStart("ddsuuu ", "d"));
System.out.println(StringUtils.stripEnd("dabads", "das"));
System.out.println(StringUtils.equals(null, null));
System.out.println(StringUtils.equalsIgnoreCase("abc", "ABc"));
System.out.println(StringUtils.indexOf(null, "a"));
System.out.println(StringUtils.indexOf("akfekcd中華", "k", 2));
System.out.println(StringUtils.ordinalIndexOf("akfekcd中華", "k", 2));
System.out.println(StringUtils.indexOfIgnoreCase("adfs", "D"));
System.out.println(StringUtils.indexOfIgnoreCase("adfs", "a", 3));
System.out.println(StringUtils.lastIndexOf("adfas", "a"));
System.out.println(StringUtils.lastIndexOf("d餓abasdafs我", "a", 3));
System.out.println(StringUtils.lastOrdinalIndexOf("yksdfdht", "f", 2));
System.out.println(StringUtils.lastIndexOfIgnoreCase("sdffet", "E"));
System.out.println(StringUtils.lastIndexOfIgnoreCase("efefrfs看", "F" , 2));
System.out.println(StringUtils.contains("sdf", "dg"));
System.out.println(StringUtils.containsIgnoreCase("sdf", "D"));
System.out.println(StringUtils.containsWhitespace(" d"));
System.out.println(StringUtils.indexOfAny("absfekf", new String[]{"f", "b"}));
System.out.println(StringUtils.indexOfAny("afefes", "e"));
System.out.println(StringUtils.containsAny("asfsd", new char[]{'k', 'e', 's'}));
System.out.println(StringUtils.containsAny("啡f咖啡", "咖"));
System.out.println(StringUtils.indexOfAnyBut("seefaff", "af"));
System.out.println(StringUtils.containsOnly("中華華", "華"));
System.out.println(StringUtils.containsOnly("中華中", new char[]{'中', '華'}));
System.out.println(StringUtils.containsNone("中華華", "國"));
System.out.println(StringUtils.containsNone("中華中", new char[]{'中', '華'}));
System.out.println(StringUtils.lastIndexOfAny("中國人民共和國", new String[]{"國人", "共和"}));
System.out.println(StringUtils.countMatches("中國人民共和中國", "中國"));
System.out.println(StringUtils.isAlpha("這是幹什麼的2"));
System.out.println(StringUtils.isAlphaSpace("NBA直播 "));
System.out.println(StringUtils.isAlphanumeric("NBA直播"));
System.out.println(StringUtils.isAlphanumericSpace("NBA直播"));
System.out.println(StringUtils.isAsciiPrintable("NBA直播"));
System.out.println(StringUtils.isNumeric("NBA直播"));
System.out.println(StringUtils.isNumericSpace("33 545"));
System.out.println(StringUtils.isWhitespace(" "));
System.out.println(StringUtils.isAllLowerCase("kjk33"));
System.out.println(StringUtils.isAllUpperCase("KJKJ"));
System.out.println(StringUtils.difference("中國加油", "中國人民共和加油"));
System.out.println(StringUtils.indexOfDifference("ww.taobao", "www.taobao.com"));
System.out.println(StringUtils.indexOfDifference(new String[] {"中國加油", "中國共和", "中國人民"}));
System.out.println(StringUtils.getCommonPrefix(new String[] {"中國加油", "中國共和", "中國人民"}));
System.out.println(StringUtils.getLevenshteinDistance("中國共和發國人民", "共和國"));
System.out.println(StringUtils.startsWith("中國共和國人民", "中國"));
System.out.println(StringUtils.startsWithIgnoreCase("中國共和國人民", "中國"));
System.out.println(StringUtils.startsWithAny("abef", new String[]{"ge", "af", "ab"}));
System.out.println(StringUtils.endsWith("abcdef", "def"));
System.out.println(StringUtils.endsWithIgnoreCase("abcdef", "Def"));
System.out.println(StringUtils.substring("國民黨", 2));
System.out.println(StringUtils.substring("中國人民共和國", 2, 4));
System.out.println(StringUtils.left("說點什麼好呢", 3));
System.out.println(StringUtils.right("說點什麼好呢", 3));
System.out.println(StringUtils.mid("說點什麼好呢", 3, 2));
System.out.println(StringUtils.substringBefore("說點什麼好呢", "好"));
System.out.println(StringUtils.substringAfter("說點什麼好呢", "點"));
System.out.println(StringUtils.substringBeforeLast("說點什麼好點呢", "點"));
System.out.println(StringUtils.substringAfterLast("說點什麼好點呢?", "點"));
System.out.println(StringUtils.substringBetween("南非2010世界盃在南非,在南非", "南非"));
System.out.println(StringUtils.join(getArrayData()));
System.out.println(StringUtils.join(getArrayData(), ":"));
System.out.println(StringUtils.join(getArrayData(), ":", 1, 3));
System.out.println(StringUtils.join(getListData(), ":"));
System.out.println(StringUtils.deleteWhitespace(" s 中 你 4j"));
System.out.println(StringUtils.removeStart("www.baidu.com", "www."));
System.out.println(StringUtils.removeStartIgnoreCase("www.baidu.com", "WWW"));
System.out.println(StringUtils.removeEnd("www.baidu.com", ".com"));
System.out.println(StringUtils.removeEndIgnoreCase("www.baidu.com", ".COM"));
System.out.println(StringUtils.remove("www.baidu.com/baidu", "bai"));
System.out.println(StringUtils.chomp("abcrabc\r"));
System.out.println(StringUtils.chomp("baidu.com", "com"));
System.out.println(StringUtils.chop("wwe.baidu"));
System.out.println(StringUtils.replaceOnce("www.baidu.com/baidu", "baidu", "hao123"));
System.out.println(StringUtils.replace("www.baidu.com/baidu", "baidu", "hao123"));
System.out.println(StringUtils.replace("www.baidu.com/baidu", "baidu", "hao123", 1));
System.out.println(StringUtils.replaceEach("www.baidu.com/baidu", new String[]{"baidu", "com"}, new String[]{"taobao", "net"}));
System.out.println(StringUtils.replaceEachRepeatedly("www.baidu.com/baidu", new String[]{"baidu", "com"}, new String[]{"taobao", "net"}));
System.out.println(StringUtils.replaceChars("www.baidu.com", "bdm", "qo"));
System.out.println(StringUtils.overlay("www.baidu.com", "hao123", 4, 9));
System.out.println(StringUtils.repeat("ba", 3));
System.out.println(StringUtils.repeat("ab", "ou", 3));
System.out.println(StringUtils.rightPad("海川", 4));
System.out.println(StringUtils.rightPad("海川", 4, "河流啊"));
System.out.println(StringUtils.leftPad("海川", 4));
System.out.println(StringUtils.leftPad("海川", 4, "大家好"));
System.out.println(StringUtils.center("海川", 3));
System.out.println(StringUtils.center("海川", 5, "流"));
System.out.println(StringUtils.abbreviate("中華人民共和國", 5));
System.out.println(StringUtils.abbreviate("abcdefghijklmno", 12, 10));
System.out.println(StringUtils.abbreviateMiddle("abcdef", ".", 4));
System.out.println(StringUtils.capitalize("Ddf"));
System.out.println(StringUtils.uncapitalize("DTf"));
System.out.println(StringUtils.swapCase("I am Jiang, Hello"));
System.out.println(StringUtils.reverse("中國人民"));
System.out.println(StringUtils.reverseDelimited("中:國:人民", ':'));
}
private static void ArrayToList(String[] str) {
System.out.println(Arrays.asList(str) + " 長度:" + str.length);
}
private static List getListData() {
List list = new ArrayList();
list.add("你好");
list.add(null);
list.add("他好");
list.add("大家好");
return list;
}
private static String[] getArrayData() {
return (String[]) getListData().toArray(new String[0]);
}
public static void main(String[] args) {
TestStr();
}