今天看到Jakarta Commons Lang，发现提供了很多有用的功能,记录下来，留待以后查阅
The Commons Lang library provides much needed additions to the standard JDK's java.lang package. Very generic, very reusable components for everyday use.
String manipulation -StringUtils, StringEscapeUtils, RandomStringUtils, Tokenizer, WordUtils
RandomStringUtils speaks for itself. It's provides ways in which to generate pieces of text, such as might be used for default passwords.
Character handling - CharSetUtils, CharSet, CharRange, CharUtils
CharUtils exists for this purpose, while CharSetUtils exists for set-manipulation of Strings.Be careful, although CharSetUtils takes an argument of type String, it is only as a set of characters. For example,
CharSetUtils.delete("testtest", "tr") will remove all t's and all r's from the String, not just the String "tr".
JVM interaction - SystemUtils, CharEncoding
SystemUtils is a simple little class which makes it easy to find out information about which platform you are on。
The CharEncoding class is also used to interact with the Java environment and may be used to see which character encodings are supported in a particular environment.
Serialization - SerializationUtils, SerializationException
Assorted functions - ObjectUtils, ClassUtils, ArrayUtils, BooleanUtils
ClassUtils is largely a set of helper methods for reflection. Of special note are the comparators hidden away in ClassUtils, useful for sorting Class and Package objects by name。
ArrayUtils. This is a big one with many methods and many overloads of these methods so it is probably worth an in depth look here. Before we begin, assume that every method mentioned is overloaded for all the primitives and for Object. Also, the short-hand 'xxx' implies a generic primitive type, but usually also includes Object.
Flotsam - BitField, Validate
On reaching the end of our package, we are left with a couple of classes that haven't fit any of the topics so far.
The BitField class provides a wrapper class around the classic bitmask integer, whilst the Validate class may be used for assertions
HashCodeBuilder will save your day. It, and its buddies (EqualsBuilder, CompareToBuilder, ToStringBuilder), take care of the nasty bits while you focus on the important bits, like which fields will go into making up the hashcode.
lang.enums.* (formerly lang.enum)
These include classes to represent ranges of numbers, a Fraction class, various utilities for random numbers, and the flagship class, NumberUtils which contains a handful of classic number functions.
mutable package provides mutable wrappers for primitive values (such as int, long, etc.) and Object. These wrappers are simiar to the wrappers provided by the Java API, but allow the wrapped value to be changed without needing to create a separate wrapper object.
It provides, amongst other classes, a replacement for StringBuffer named
StrBuilder, a class for substituting variables within a String named
StrSubstitutor and a replacement for StringTokenizer named
StrTokenizer. While somewhat ungainly, the
Str prefix has been used to ensure we don't clash with any current or future standard Java classes.
These include a StopWatch for simple performance measurements and an optimised FastDateFormat class.