方法 作用
isBlank 判断某字符串是否为空、长度为0、由空白符(whitespace) 构成。isBlank(" ")为true。多数情况用 isBlank
isEmpty 判断某字符串是否为空,为空的标准是 strnull 或 str.length()0。isEmpty(" ")为false
trim 去掉字符串两端的控制符(control characters, char <= 32)。如果为null或"",则返回null
strip 去掉字符串两端的空白符(whitespace)。如果输入为null则返回null
  • StringUtils 说明:
Operations on String that are null safe.

IsEmpty/IsBlank - checks if a String contains text
Trim/Strip - removes leading and trailing whitespace
Equals/Compare - 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
Rotate - rotate (circular shift) a String
Reverse/ReverseDelimited - reverses a String
Abbreviate - abbreviates a string using ellipsis or another given String
Difference - compares Strings and reports on their differences
LevenshteinDistance - 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()

最新文章

  1. Ionic页面加载前 ionic页面加载完成 ionic页面销毁执行的事件
  2. 初学python之安装Jupyter notebook
  3. where和having子句的区别
  4. 外部dtd
  5. XML通過XSD產生CLASS
  6. wait、waitpid 僵尸进程 孤儿进程
  7. hdu 4315 Climbing the Hill 博弈论
  8. python学习[二]
  9. android拦截短信并屏蔽系统的Notification
  10. 解决浏览器兼容问题的css hack
  11. webstorm常用快捷键及(idea,phpstorm,android studio通用)使用技巧
  12. Chapter 14_5 _ENV和load
  13. Google 怎么搜索
  14. HDU 3569 Imaginary Date 简单期望
  15. 【C#附源码】数据库文档生成工具支持(Excel+Htm)
  16. C#编程语言之委托与事件(二)—— C#事件
  17. shell脚本学习-执行
  18. PD915温度太高,通过设置BIOS降底CPU的核心电压来降温。
  19. PHP - CentOS下开发运行环境搭建(Apache+PHP+MySQL+FTP)
  20. SQL数据查询之——单表查询

热门文章

  1. C++中的this指针
  2. STL_string
  3. python 爬取妹子图
  4. ubuntu下没有Language Support
  5. React脚手架create-react-app+elementUI使用
  6. Cxfreeze使用存在问题
  7. div在IE6中固定
  8. struts2 的学习
  9. 《Python》 列表、元祖和range
  10. DevExpress Add ASPxGridView template columns at runtime