1. 程式人生 > >Java實用類庫之StringUtils

Java實用類庫之StringUtils

檢查 commons org extract repeat emp rac href string

org.apache.commons.lang.StringUtils

作為jdk中lang包的補充

檢查CharSequence是否為空,null或者空格

CharSequence (CharBuffer, Segment, String, StringBuffer, StringBuilder)

  • isBlank(CharSequence) 可以檢查空,null和空格
  • isEmpty(CharSequence) 只能檢查空和null
  • 還有isNotBlank(cs)和isNotEmpt(cs)

字符串截取

Substring/Left/Right/Mid - null-safe substring extractions

字符串補全

LeftPad/RightPad/Center/Repeat - pads a String

參考

  • doc:https://commons.apache.org/proper/commons-lang/apidocs/index.html?org/apache/commons/lang3/StringUtils.html
  • apache下載:https://commons.apache.org/proper/commons-lang/

Java實用類庫之StringUtils