一:StringUtils:操作字符串的工具类。 常用方法:
isNotBlank():判断字符串!=null&&!=“”
isEmpty():判断字符串是否为null || ""
isAnyEmpty():任意一个参数为空的话,返回true;
isNoneEmpty():所有参数都不为空,返回true;
isBlank():判断字符串是否空字符串;例如isBlank(" ")返回true;isEmpty(" ")返回为false;(ps:blank为空白的意思,empty为空的意思,很好理解)
equalsIgnoreCase():比较忽略大小写的字符串,用于验证码判断很好;
equals():判断字符串是否值相等;(ps:判断两个为null的空值不报异常)
参考文档:http://commons.apache.org/proper/commons-lang/apidocs/org/apache/commons/lang3/StringUtils.html
二:FileUtils:操作io流的工具类
copyFile(final File srcFile, final File destFile) //复制文件到另外一个文件
void copyFileToDirectory( file1 , file2) //复制文件到一个指定的目录
void copyURLToFile(final URL source, final File destination)//把URL 里面内容复制到文件。可以下载文件。
List<String> readLines(final File file, final String encoding)//把文件读取成字符串集合 ;String encoding:编码格式
copyInputStreamToFile(InputStream, File) : void//将流写入文件里
三:DateUtils和DateFormatUtils:
DateUtils.parseDate(String,"yyyy-MM-dd");//将String内型的日期转为时间类型的。
DateUtils.addDays(example,-1)//天数减一,ps:月份即addMonth()
isSameDay(date1,date2);/判断是否同一天。参数可以传日期格式或者calendar.
DateFormatUtils.format(example,"yyyy-MM-dd")//将日期转为为特有的格式
参考文档:https://blog.csdn.net/u012558400/article/details/53157412