Apache Commons Lang

http://commons.apache.org/proper/commons-lang/javadocs/api-release/org/apache/commons/lang3/package-summary.html

1. Commons Lang 是对java.lang的一个扩展

2. String

StringEscapeUtils 提供随机的一段字符串,一般用于产生随机密码   StringEscapeUtils.random(int count)

RandomStringUtils 对Java, Java Script, HTML and XML 提供转义 

StringUtils 

  • IsEmpty/IsBlank - checks if a String contains text
  • Trim/Strip - removes leading and trailing whitespace
  • Equals - compares two strings null-safe
  • startsWith - check if a String starts with a prefix null-safe
  • endsWith - check if a String ends with a suffix null-safe
  • IndexOf/LastIndexOf/Contains - null-safe index-of checks
  • IndexOfAny/LastIndexOfAny/IndexOfAnyBut/LastIndexOfAnyBut - index-of any of a set of Strings
  • ContainsOnly/ContainsNone/ContainsAny - does String contains only/none/any of these characters
  • Substring/Left/Right/Mid - null-safe substring extractions
  • SubstringBefore/SubstringAfter/SubstringBetween - substring extraction relative to other strings
  • Split/Join - splits a String into an array of substrings and vice versa
  • Remove/Delete - removes part of a String
  • Replace/Overlay - Searches a String and replaces one String with another
  • Chomp/Chop - removes the last part of a String
  • AppendIfMissing - appends a suffix to the end of the String if not present
  • PrependIfMissing - prepends a prefix to the start of the String if not present
  • LeftPad/RightPad/Center/Repeat - pads a String
  • UpperCase/LowerCase/SwapCase/Capitalize/Uncapitalize - changes the case of a String
  • CountMatches - counts the number of occurrences of one String in another
  • IsAlpha/IsNumeric/IsWhitespace/IsAsciiPrintable - checks the characters in a String
  • DefaultString - protects against a null input String
  • Reverse/ReverseDelimited - reverses a String
  • Abbreviate - abbreviates a string using ellipsis
  • Difference - compares Strings and reports on their differences
  • LevenshteinDistance - the number of changes needed to change one String into another

3. Character

  • CharSet 
  • CharRange
  • CharSetUtils
  • CharUtils

4. JVM interaction - SystemUtils, CharEncoding

  • SystemUtils: Helpers for java.lang.System
  • CharEncoding

5.Serialization 

  • SerializationUtils 
    •   SerializationUtils.clone(T object)  Deep clone an Object using serialization.
  • SerializationException

6.Assorted functions -

  • ObjectUtils
  • ClassUtils
  • ArrayUtils
    • ArrayUtils provides singleton empty arrays for all the basic types. These will largely be of use in the Collections API with its toArray methods, but also will be of use with methods which want to return an empty array on error.
    • add(xxx[], xxx) will add a primitive type to an array, resizing the array as you'd expect. Object is also supported.
    • clone(xxx[]) clones a primitive or Object array.
    • contains(xxx[], xxx) searches for a primitive or Object in a primitive or Object array.
    • getLength(Object) returns the length of any array or an IllegalArgumentException if the parameter is not an array. hashCode(Object)equals(Object, Object)toString(Object)
    • indexOf(xxx[], xxx) and indexOf(xxx[], xxx, int) are copies of the classic String methods, but this time for primitive/Object arrays. In addition, a lastIndexOf set of methods exists.
    • isEmpty(xxx[]) lets you know if an array is zero-sized or null.
    • isSameLength(xxx[], xxx[]) returns true if the arrays are the same length.
    • Along side the add methods, there are also remove methods of two types. The first type remove the value at an index, remove(xxx[], int), while the second type remove the first value from the array, remove(xxx[], xxx).
    • Nearing the end now. The reverse(xxx[]) method turns an array around.
    • The subarray(xxx[], int, int) method splices an array out of a larger array.
    • Primitive to primitive wrapper conversion is handled by the toObject(xxx[]) and toPrimitive(Xxx[]) methods.
    • ArrayUtils.toMap(Object[])
  • BooleanUtils  BooleanUtils.toBoolean(String)

7. Flotsam 

  • BitField
  • Validate
原文地址:https://www.cnblogs.com/zeng200103/p/3779934.html