码迷,mamicode.com
首页 > 其他好文 > 详细

Commons-Lang - StringUtils

时间:2016-06-30 16:22:15      阅读:113      评论:0      收藏:0      [点我收藏+]

标签:

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

 

Commons-Lang - StringUtils

标签:

原文地址:http://www.cnblogs.com/huey/p/5630227.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!