强大的StringUtils
来源:互联网 发布:中国人的乡土情结 知乎 编辑:程序博客网 时间:2024/06/04 19:35
- public class StringUtils
- extends java.lang.Object
Operations on String
that are null
safe.
- 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
- 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
- LevensteinDistance - the number of changes needed to change one String into another
The StringUtils
class defines certain words related to String handling.
- null -
null
- empty - a zero-length string (
""
) - space - the space character (
' '
, char 32) - whitespace - the characters defined by
Character.isWhitespace(char)
- trim - the characters <= 32 as in
String.trim()
StringUtils
handles null
input Strings quietly. That is to say that a null
input will return null
. Where a boolean
or int
is being returned details vary by method.
A side effect of the null
handling is that a NullPointerException
should be considered a bug in StringUtils
(except for deprecated methods).
Methods in this class give sample code to explain their operation. The symbol *
is used to indicate any input including null
.
- 强大的StringUtils
- 参悟spring中的StringUtils部分强大的功能
- StringUtils.isEmpty()、StringUtils.isBlank()和StringUtils.trim()的用法
- StringUtils.isBlank和StringUtils.isEmpty的异同
- StringUtils的常用方法 对StringUtils介绍
- StringUtils 的几个方法
- StringUtils的几个方法
- StringUtils的使用
- StringUtils的一些使用
- java 的StringUtils方法
- StringUtils类的使用
- StringUtils的各项用法
- StringUtils的各项用法
- StringUtils的API
- StringUtils 的使用
- StringUtils 的用法
- StringUtils常用的方法
- StringUtils的常见方法
- ScanWorkFlow工作流系统
- Flight Simulator X For Pilots Real World Training
- How to Cheat in Photoshop CS3: The art of creating photorealistic montages
- 嘿,你的产品好用吗?
- PgMP: Program Management Professional Exam Study Guide
- 强大的StringUtils
- 3G Evolution
- Sams Teach Yourself Visual Studio .NET 2003 in 21 Days
- 应用OSCache提升J2EE系统运行性能
- Analyzing Receiver Operating Characteristic Curves With SAS
- Mastering Autodesk VIZ 2008
- Visual Basic .NET and the .NET Platform: An Advanced Guide
- Backup Exec 9: For Windows Servers
- 惠普中国局