类 StringUtils
java.lang.Object
com.alibaba.nacos.common.utils.StringUtils
string util.
- 作者:
- Nacos
-
字段概要
字段 -
构造器概要
构造器 -
方法概要
修饰符和类型方法说明static booleancontainsIgnoreCase(CharSequence str, CharSequence searchStr)Checks if CharSequence contains a search CharSequence irrespective of case, handlingnull.static StringdefaultIfEmpty(String str, String defaultStr)static booleanstatic booleanequalsIgnoreCase(CharSequence str1, CharSequence str2)Compares two CharSequences, returningtrueif they represent equal sequences of characters, ignoring case.static StringescapeJavaScript(String str)static booleanisAllBlank(String... strs)Judge whether all strings are blank.static booleanJudge whether string is blank.static booleanstatic booleanisNotBlank(String str)static booleanisNotEmpty(String str)static Stringjoin(Collection collection, String separator)Join object with input separator.static StringnewStringForUtf8(byte[] bytes)static StringsubstringBetween(String str, String open, String close)Substring between two index.static String
-
字段详细资料
-
构造器详细资料
-
StringUtils
public StringUtils()
-
-
方法详细资料
-
newStringForUtf8
-
isBlank
Judge whether string is blank.- 参数:
str- string- 返回:
- true if str is null, empty string or only blanks, otherwise false
-
isAllBlank
Judge whether all strings are blank.- 参数:
strs- strings- 返回:
- true if all strings are blank, otherwise false
-
isNotBlank
-
isNotEmpty
-
isEmpty
-
defaultIfEmpty
-
equals
-
trim
-
substringBetween
Substring between two index.- 参数:
str- stringopen- start index to subclose- end index to sub- 返回:
- substring
-
join
Join object with input separator.- 参数:
collection- collection of objects need to joinseparator- separator- 返回:
- joined string
-
escapeJavaScript
-
containsIgnoreCase
Checks if CharSequence contains a search CharSequence irrespective of case, handlingnull. Case-insensitivity is defined as byString.equalsIgnoreCase(String).A
nullCharSequence will returnfalse.StringUtils.contains(null, *) = false StringUtils.contains(*, null) = false StringUtils.contains("", "") = true StringUtils.contains("abc", "") = true StringUtils.contains("abc", "a") = true StringUtils.contains("abc", "z") = false StringUtils.contains("abc", "A") = true StringUtils.contains("abc", "Z") = false- 参数:
str- the CharSequence to check, may be nullsearchStr- the CharSequence to find, may be null- 返回:
- true if the CharSequence contains the search CharSequence irrespective of case or false if not or
nullstring input - 从以下版本开始:
- 3.0 Changed signature from containsIgnoreCase(String, String) to containsIgnoreCase(CharSequence, CharSequence)
-
equalsIgnoreCase
Compares two CharSequences, returning
trueif they represent equal sequences of characters, ignoring case.nulls are handled without exceptions. Twonullreferences are considered equal. Comparison is case insensitive.StringUtils.equalsIgnoreCase(null, null) = true StringUtils.equalsIgnoreCase(null, "abc") = false StringUtils.equalsIgnoreCase("abc", null) = false StringUtils.equalsIgnoreCase("abc", "abc") = true StringUtils.equalsIgnoreCase("abc", "ABC") = true- 参数:
str1- the first CharSequence, may be nullstr2- the second CharSequence, may be null- 返回:
trueif the CharSequence are equal, case insensitive, or bothnull- 从以下版本开始:
- 3.0 Changed signature from equalsIgnoreCase(String, String) to equalsIgnoreCase(CharSequence, CharSequence)
-