public final class Strings
extends java.lang.Object
| Modifier and Type | Method and Description |
|---|---|
static java.lang.CharSequence |
clean(java.lang.CharSequence str) |
static java.lang.String |
clean(java.lang.String str) |
static boolean |
hasLength(java.lang.CharSequence str)
Check that the given CharSequence is neither
null nor of length 0. |
static boolean |
hasText(java.lang.CharSequence str)
Check whether the given CharSequence has actual text.
|
static boolean |
hasText(java.lang.String str)
Check whether the given String has actual text.
|
static java.lang.String |
trimWhitespace(java.lang.String str)
Trim leading and trailing whitespace from the given String.
|
public static boolean hasLength(java.lang.CharSequence str)
null nor of length 0.
Note: Will return true for a CharSequence that purely consists of whitespace.
Strings.hasLength(null) = false
Strings.hasLength("") = false
Strings.hasLength(" ") = true
Strings.hasLength("Hello") = true
str - the CharSequence to check (may be null)true if the CharSequence is not null and has lengthhasText(String)public static boolean hasText(java.lang.CharSequence str)
true if the string not null,
its length is greater than 0, and it contains at least one non-whitespace character.
Strings.hasText(null) = false
Strings.hasText("") = false
Strings.hasText(" ") = false
Strings.hasText("12345") = true
Strings.hasText(" 12345 ") = true
str - the CharSequence to check (may be null)true if the CharSequence is not null,
its length is greater than 0, and it does not contain whitespace onlyCharacter.isWhitespace(char)public static boolean hasText(java.lang.String str)
true if the string not null,
its length is greater than 0, and it contains at least one non-whitespace character.str - the String to check (may be null)true if the String is not null, its length is
greater than 0, and it does not contain whitespace onlyhasText(CharSequence)public static java.lang.String trimWhitespace(java.lang.String str)
str - the String to checkCharacter.isWhitespace(char)public static java.lang.String clean(java.lang.String str)
public static java.lang.CharSequence clean(java.lang.CharSequence str)
Copyright © 2019-2020 paseto.dev. All Rights Reserved.