
Apache commons
zyt_coder
这个作者很懒,什么都没留下…
展开
-
格式化字符串长度不够补0
最近项目需要格式化字符串的指定长度,不够的前面补零大部分是用String.format去做的public static void main(String[] args) { String str="%04d"; System.out.println(String.format(str, 15));}输出: 0015 但是我需要的是格式化字符串,后来我想StringUtils专门原创 2016-07-14 15:08:36 · 11732 阅读 · 1 评论 -
apache commons
apache commons 里面有许多开发用到的工具类,可以节省我们很多的开发时间,而且很好用 例如 StringUtils CollectionUtils FileUtils等 maven依赖 <dependency> <groupId>org.apache.commons</groupId> <artifactId>common原创 2016-06-23 11:14:50 · 528 阅读 · 0 评论 -
md5
maven依赖<dependency> <groupId>commons-codec</groupId> <artifactId>commons-codec</artifactId> <version>1.9</version></dependency>MD5 :DigestUtils.md5Hex(String code)原创 2016-06-23 11:24:49 · 335 阅读 · 0 评论 -
根据枚举名转换成枚举类型
有时候我们需要将某个字符串类型的枚举名转换为枚举类型,Apache common lang 包里面的EnumUtils可以帮我们做到maven 依赖,这里我用的是lang3<dependency> <groupId>org.apache.commons</groupId> <artifactId>commons-lang3</artifactId>原创 2016-08-02 11:36:51 · 2033 阅读 · 0 评论 -
大文件读取(超过内存)
package com.zyt.interview;import java.io.BufferedReader;import java.io.File;import java.io.FileInputStream;import java.io.FileNotFoundException;import java.io.FileReader;import java.io.IOException原创 2017-03-16 19:47:10 · 2644 阅读 · 0 评论