类 StringUtils
java.lang.Object
com.alibaba.nacos.api.utils.StringUtils
StringUtils. copy from apache common-lang3.
- 作者:
- lin-mt
-
字段概要
字段 -
构造器概要
构造器 -
方法概要
修饰符和类型方法说明static booleanequals(CharSequence cs1, CharSequence cs2)Compares two CharSequences, returningtrueif they represent equal sequences of characters.static booleanisBlank(CharSequence cs)Checks if a CharSequence is whitespace, empty ("") or null.static booleanisEmpty(CharSequence cs)Checks if a CharSequence is empty ("") or null.static booleanregionMatches(CharSequence cs, boolean ignoreCase, int thisStart, CharSequence substring, int start, int length)Green implementation of regionMatches.static StringRemoves control characters (char <= 32) from both ends of this String, handlingnullby returningnull.
-
字段详细资料
-
EMPTY
The empty String"".- 从以下版本开始:
- 2.0
- 另请参阅:
- 常量字段值
-
-
构造器详细资料
-
StringUtils
public StringUtils()
-
-
方法详细资料
-
isEmpty
Checks if a CharSequence is empty ("") or null.
StringUtils.isEmpty(null) = true StringUtils.isEmpty("") = true StringUtils.isEmpty(" ") = false StringUtils.isEmpty("bob") = false StringUtils.isEmpty(" bob ") = falseNOTE: This method changed in Lang version 2.0. It no longer trims the CharSequence. That functionality is available in isBlank().
- 参数:
cs- the CharSequence to check, may be null- 返回:
trueif the CharSequence is empty or null- 从以下版本开始:
- 3.0 Changed signature from isEmpty(String) to isEmpty(CharSequence)
-
isBlank
Checks if a CharSequence is whitespace, empty ("") or null.
StringUtils.isBlank(null) = true StringUtils.isBlank("") = true StringUtils.isBlank(" ") = true StringUtils.isBlank("bob") = false StringUtils.isBlank(" bob ") = false- 参数:
cs- the CharSequence to check, may be null- 返回:
trueif the CharSequence is null, empty or whitespace- 从以下版本开始:
- 2.0, 3.0 Changed signature from isBlank(String) to isBlank(CharSequence)
-
trim
Removes control characters (char <= 32) from both ends of this String, handling
nullby returningnull.The String is trimmed using
String.trim(). Trim removes start and end characters <= 32.StringUtils.trim(null) = null StringUtils.trim("") = "" StringUtils.trim(" ") = "" StringUtils.trim("abc") = "abc" StringUtils.trim(" abc ") = "abc"- 参数:
str- the String to be trimmed, may be null- 返回:
- the trimmed string,
nullif null String input
-
equals
Compares two CharSequences, returning
trueif they represent equal sequences of characters.nulls are handled without exceptions. Twonullreferences are considered to be equal. The comparison is case sensitive.StringUtils.equals(null, null) = true StringUtils.equals(null, "abc") = false StringUtils.equals("abc", null) = false StringUtils.equals("abc", "abc") = true StringUtils.equals("abc", "ABC") = false- 参数:
cs1- the first CharSequence, may benullcs2- the second CharSequence, may benull- 返回:
trueif the CharSequences are equal (case-sensitive), or bothnull- 从以下版本开始:
- 3.0 Changed signature from equals(String, String) to equals(CharSequence, CharSequence)
- 另请参阅:
Object.equals(Object)
-
regionMatches
public static boolean regionMatches(CharSequence cs, boolean ignoreCase, int thisStart, CharSequence substring, int start, int length)Green implementation of regionMatches.- 参数:
cs- theCharSequenceto be processedignoreCase- whether or not to be case insensitivethisStart- the index to start on thecsCharSequencesubstring- theCharSequenceto be looked forstart- the index to start on thesubstringCharSequencelength- character length of the region- 返回:
- whether the region matched
-