Package org.apache.hc.core5.util
Class TextUtils
java.lang.Object
org.apache.hc.core5.util.TextUtils
- Since:
- 4.3
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic bytecastAsByte(int c) Casts character to byte filtering non-visible and non-ASCII characters before conversionstatic booleanstatic booleanChecks if a CharSequence is empty (""), null or whitespace only.static booleanReturns true if the parameter is null or of zero lengthstatic intlength(CharSequence cs) Gets a CharSequence length or0if the CharSequence isnull.static StringtoHexString(byte[] bytes) Returns a hexadecimal string with lowercase letters, representing the values of thebytes.static StringReturns lower case representation of the given string usingLocale.ROOT.
-
Constructor Details
-
TextUtils
private TextUtils()
-
-
Method Details
-
isEmpty
Returns true if the parameter is null or of zero length -
isBlank
Checks if a CharSequence is empty (""), null or whitespace only.
Whitespace is defined by
Character.isWhitespace(char).TextUtils.isBlank(null) = true TextUtils.isBlank("") = true TextUtils.isBlank(" ") = true TextUtils.isBlank("abg") = false TextUtils.isBlank(" abg ") = false- Parameters:
s- the CharSequence to check, may be null- Returns:
trueif the CharSequence is null, empty or whitespace only
-
length
Gets a CharSequence length or0if the CharSequence isnull.- Parameters:
cs- a CharSequence ornull- Returns:
- CharSequence length or
0if the CharSequence isnull. - Since:
- 5.1
-
containsBlanks
- Since:
- 4.4
-
toHexString
Returns a hexadecimal string with lowercase letters, representing the values of thebytes.- Parameters:
bytes- whose hex string should be created- Returns:
- hex string for the bytes
- Since:
- 5.0
-
toLowerCase
Returns lower case representation of the given string usingLocale.ROOT.- Since:
- 5.2
-
castAsByte
Casts character to byte filtering non-visible and non-ASCII characters before conversion- Since:
- 5.2
-