Commons Lang - StringUtils

Operations on String that are null safe.

 

IsEmpty/IsBlank - checks if a String is empty (判断字符串是否为空)

 

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 (预防 null)

 

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

 

 

More: JavaDoc

 

posted on 2016-06-30 15:48  huey2672  阅读(242)  评论(0编辑  收藏  举报