Stringutils
String join = StringUtils.join(list, ";"); 将list转乘字符串,;作为分隔符
String replace = StringUtils.replace(join, ";", ","); 将字符串replace,把所有;替换成,
CollectionDemo
List<String> list1 = IteratorUtils.toList(list.iterator()); 将迭代器退还成list
DateDemo
传入时间的类型。进行parse成date
String parses[] =new String[]{"yyyy-MM-dd HH:mm:ss","yyyy/MM/dd HH:mm:ss","yyyy MM dd HH mm ss"};
Date date = DateUtils.parseDate("2015/7/12 12:12:12", parses);
String format = DateFormatUtils.format(date, "yyyy_MM_dd HH:mm:ss"); 将date时间format格式化成自己想要的类型。可以设置时区等参数
加密工具
commons-codec 包含了常见的md5 sha1等加密 String md5 = DigestUtils.md5Hex("source String");//md5 加密成字符串 apache.commons.codec.digest.DigestUtils;