Apache Commons Lang

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

 

1. Commons Lang 是對java.lang的一個擴展java

2. Stringapache

StringEscapeUtils 提供隨機的一段字符串,通常用於產生隨機密碼   StringEscapeUtils.random(int count)api

RandomStringUtils 對Java, Java Script, HTML and XML 提供轉義 app

StringUtils dom

  • 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. Characteride

  • CharSet 
  • CharRange
  • CharSetUtils
  • CharUtils

4. JVM interaction - SystemUtils, CharEncodingthis

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

5.Serialization spa

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

6.Assorted functions - code

  • 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
相關文章
相關標籤/搜索