Top Description Constructors Methods
io.micrometer.common.util

public final Class StringUtils

extends Object
Class Inheritance
Imports
io.micrometer.common.lang.Nullable

Utilities for String.
Author
Johnny Lim

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
public static boolean

Returns:

true if the String is null or has only whitespaces
isBlank
(String
String to check
string
)

Check if the String is null or has only whitespaces.

public static boolean

Returns:

true if the String is null or empty
isEmpty
(String
String to check
string
)

Check if the String is null or empty.

public static boolean

Returns:

true if the String has any non-whitespace character
isNotBlank
(String
String to check
string
)

Check if the String has any non-whitespace character.

public static boolean

Returns:

true if the String has any character
isNotEmpty
(String
String to check
string
)

Check if the String has any character.

public static String

Returns:

truncated String
truncate
(String
String to truncate
string
,
int
max length
maxLength
)

Truncate the String to the max length.

public static String

Returns:

truncated String
truncate
(String
String to truncate
string
,
int
max length, which includes the length required for truncationIndicator
maxLength
,
String
A string that is appended if string is truncated
truncationIndicator
)

Truncate the String to the max length and append string to indicate if truncation was applied

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Constructor Detail

StringUtilsback to summary
private StringUtils()

Method Detail

isBlankback to summary
public static boolean isBlank(String string)

Check if the String is null or has only whitespaces. Modified from org.apache.commons.lang.StringUtils#isBlank(String).

Parameters
string:String

String to check

Returns:boolean

true if the String is null or has only whitespaces

isEmptyback to summary
public static boolean isEmpty(String string)

Check if the String is null or empty.

Parameters
string:String

String to check

Returns:boolean

true if the String is null or empty

isNotBlankback to summary
public static boolean isNotBlank(String string)

Check if the String has any non-whitespace character.

Parameters
string:String

String to check

Returns:boolean

true if the String has any non-whitespace character

isNotEmptyback to summary
public static boolean isNotEmpty(String string)

Check if the String has any character.

Parameters
string:String

String to check

Returns:boolean

true if the String has any character

Since
1.1.0
truncateback to summary
public static String truncate(String string, int maxLength)

Truncate the String to the max length.

Parameters
string:String

String to truncate

maxLength:int

max length

Returns:String

truncated String

truncateback to summary
public static String truncate(String string, int maxLength, String truncationIndicator)

Truncate the String to the max length and append string to indicate if truncation was applied

Parameters
string:String

String to truncate

maxLength:int

max length, which includes the length required for truncationIndicator

truncationIndicator:String

A string that is appended if string is truncated

Returns:String

truncated String