Package dev.enola.common
Class MoreStrings
java.lang.Object
dev.enola.common.MoreStrings
-
Method Summary
Modifier and TypeMethodDescriptionstatic intstatic @Nullable StringnormalizeWhitespace(@Nullable String input) Replaces consecutive whitespace characters with a single space and trims leading and trailing whitespace.static StringtoTitleCase(@Nullable String input) Converts a delimiter-separated string (e.g.static @Nullable StringtrimToNull(@Nullable String input) Returns the trimmed string, ornullif the input is null, empty, or whitespace-only.
-
Method Details
-
compare
-
toTitleCase
Converts a delimiter-separated string (e.g. kebab-case, snake_case, or space-separated) into generic Title Case with space separators. -
trimToNull
Returns the trimmed string, ornullif the input is null, empty, or whitespace-only.Complementary to Guava's
Strings.emptyToNull(String). -
normalizeWhitespace
Replaces consecutive whitespace characters with a single space and trims leading and trailing whitespace. Returnsnullif input is null, empty, or whitespace-only.- Parameters:
input- the string to normalize- Returns:
- the normalized string, or
nullif input is blank or null
-