Commons-Lang - StringUtils

Posted huey

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了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

 

以上是关于Commons-Lang - StringUtils的主要内容,如果未能解决你的问题,请参考以下文章

StringUtil startWith

StringUtil工具类

StringUtil字符串工具类

Android smack.util.StringUtil 没有 parseBareAddress

[ StringUtil ] isEmpty VS isBlank

StringUtil方法全集