@API(value=Internal) public final class StringUtils extends Object
Strings
,
CharSequences
, etc.
These utilities are intended solely for usage within the JUnit framework itself. Any usage by external parties is not supported. Use at your own risk!
Modifier and Type | Method and Description |
---|---|
static boolean |
containsIsoControlCharacter(String str)
Determine if the supplied
String contains any ISO control characters. |
static boolean |
containsWhitespace(String str)
Determine if the supplied
String contains any whitespace characters. |
static boolean |
doesNotContainIsoControlCharacter(String str)
Determine if the supplied
String does not contain any ISO control
characters. |
static boolean |
doesNotContainWhitespace(String str)
Determine if the supplied
String does not contain any whitespace
characters. |
static boolean |
isBlank(String str)
Determine if the supplied
String is blank (i.e.,
null or consisting only of whitespace characters). |
static boolean |
isNotBlank(String str)
|
static String |
nullSafeToString(Object obj)
Convert the supplied
Object to a String using the
following algorithm. |
public static boolean isBlank(String str)
String
is blank (i.e.,
null
or consisting only of whitespace characters).str
- the string to check; may be null
true
if the string is blankisNotBlank(String)
public static boolean isNotBlank(String str)
str
- the string to check; may be null
true
if the string is not blankisBlank(String)
public static boolean containsWhitespace(String str)
String
contains any whitespace characters.str
- the string to check; may be null
true
if the string contains whitespacecontainsIsoControlCharacter(String)
,
Character.isWhitespace(int)
public static boolean doesNotContainWhitespace(String str)
String
does not contain any whitespace
characters.str
- the string to check; may be null
true
if the string does not contain whitespacecontainsWhitespace(String)
,
containsIsoControlCharacter(String)
,
Character.isWhitespace(int)
public static boolean containsIsoControlCharacter(String str)
String
contains any ISO control characters.str
- the string to check; may be null
true
if the string contains an ISO control charactercontainsWhitespace(String)
,
Character.isISOControl(int)
public static boolean doesNotContainIsoControlCharacter(String str)
String
does not contain any ISO control
characters.str
- the string to check; may be null
true
if the string does not contain an ISO control charactercontainsIsoControlCharacter(String)
,
containsWhitespace(String)
,
Character.isISOControl(int)
public static String nullSafeToString(Object obj)
Object
to a String
using the
following algorithm.
null
, this method returns "null"
.Arrays#toString(...)
variant will be used to convert it to a String.Arrays#deepToString(Object[])
will be used to convert it to a String.toString()
on the object
will be returned.obj
- the object to convert to a String; may be null
Arrays.deepToString(Object[])
,
ClassUtils.nullSafeToString(Class...)