类 StringUtil
java.lang.Object
cn.vorbote.core.utils.StringUtil
Miscellaneous
String utility methods.
This class comes org.springframework.util.StringUtils and made some changes to fit the standard in this lib.
The original authors are:
- Rod Johnson
- Juergen Hoeller
- Keith Donald
- Rob Harrop
- Rick Evans
- Arjen Poutsma
- Sam Brannen
- Brian Clozel
- 从以下版本开始:
- 16 April 2001
- 作者:
- vorbote
-
方法概要
修饰符和类型方法说明static booleanCheck whether the givenCharSequencecontains any whitespace characters.static booleancontainsWhitespace(String str) Check whether the givenStringcontains any whitespace characters.static intTo count how many times does the substring in the base string.static booleanCheck whether the givenCharSequencecontains actual text.static booleandoesNotHaveText(String str) Check whether the givenStringcontains actual text.static StringFormat any string using wild card of "{}".static booleanhasLength(CharSequence str) Check that the givenCharSequenceis neithernullnor of length 0.static booleanCheck that the givenStringis neithernullnor of length 0.static booleanhasText(CharSequence str) Check whether the givenCharSequencecontains actual text.static booleanCheck whether the givenStringcontains actual text.static booleanDetermine if the string contains only white space characters.static booleanCheck whether the givenStringis empty.static booleanCheck the string is empty.static booleanisNotEmpty(String val) Check the string is not empty.static StringtrimAllWhitespace(String str) Trim all whitespace from the givenString: leading, trailing, and in between characters.static StringtrimWhitespace(String str) Trim leading and trailing whitespace from the givenString.
-
方法详细资料
-
isEmpty
Check whether the givenStringis empty.- 参数:
str- The candidate string.- 返回:
- Value
truewhile the candidate string is empty otherwise return valuefalse.
-
hasLength
Check that the givenCharSequenceis neithernullnor of length 0.- 参数:
str- TheCharSequenceto check (maybenull).- 返回:
- Value
trueif theCharSequenceis notnulland has length.
-
hasLength
Check that the givenStringis neithernullnor of length 0.- 参数:
str- TheStringto check (maybenull).- 返回:
- Value
trueif theStringis notnulland has length.
-
hasText
Check whether the givenCharSequencecontains actual text.- 参数:
str- TheCharSequenceto check (maybenull)- 返回:
- Value
trueif theCharSequenceis notnull, its length is greater than 0, and it does not contain whitespace only.
-
doesNotHaveText
Check whether the givenCharSequencecontains actual text.- 参数:
str- TheCharSequenceto check (maybenull)- 返回:
- Value
trueif theCharSequenceis notnull, its length is greater than 0, and it does not contain whitespace only.
-
hasText
Check whether the givenStringcontains actual text.- 参数:
str- TheStringto check (maybenull)- 返回:
- Value
trueif theStringis notnull, its length is greater than 0, and it does not contain whitespace only.
-
doesNotHaveText
Check whether the givenStringcontains actual text.- 参数:
str- TheStringto check (maybenull)- 返回:
- Value
trueif theStringisnull, its length is less than 0, or it contains whitespace only.
-
containsWhitespace
Check whether the givenCharSequencecontains any whitespace characters.- 参数:
str- TheCharSequenceto check (maybenull).- 返回:
- Value
trueif theCharSequenceis not empty and contains at lease 1 whitespace characters. - 另请参阅:
-
containsWhitespace
Check whether the givenStringcontains any whitespace characters.- 参数:
str- TheStringto check (maybenull).- 返回:
- Value
trueif theStringis not empty and contains at lease 1 whitespace characters. - 另请参阅:
-
trimWhitespace
Trim leading and trailing whitespace from the givenString.- 参数:
str- TheStringto check.- 返回:
- The trimmed
String. - 另请参阅:
-
trimAllWhitespace
Trim all whitespace from the givenString: leading, trailing, and in between characters.- 参数:
str- TheStringto check.- 返回:
- The trimmed
String. - 另请参阅:
-
count
To count how many times does the substring in the base string.- 参数:
base- The original string.substring- The substring.- 返回:
- The number of the count.
- 另请参阅:
-
isEmpty
Check the string is empty.- 参数:
val- The string you want to check- 返回:
- True while the string is empty, otherwise return false
-
isNotEmpty
Check the string is not empty.- 参数:
val- The string you want to check- 返回:
- True while the string is not empty, otherwise return false
-
isBlank
Determine if the string contains only white space characters.- 参数:
val- The string you want to check- 返回:
- True while the string is blank, otherwise return false. Blank means the string is meaningless, or it only got spaces or tabs in it.
-
format
Format any string using wild card of "{}".- 参数:
format- The origin format string.args- The args to be put into the string.- 返回:
- An formatted string.
-