Class MoreStrings

java.lang.Object
dev.enola.common.MoreStrings

public final class MoreStrings extends Object
  • Method Details

    • compare

      public static int compare(@Nullable String s1, @Nullable String s2)
    • toTitleCase

      public static String toTitleCase(@Nullable String input)
      Converts a delimiter-separated string (e.g. kebab-case, snake_case, or space-separated) into generic Title Case with space separators.
    • trimToNull

      public static @Nullable String trimToNull(@Nullable String input)
      Returns the trimmed string, or null if the input is null, empty, or whitespace-only.

      Complementary to Guava's Strings.emptyToNull(String).

    • normalizeWhitespace

      public static @Nullable String normalizeWhitespace(@Nullable String input)
      Replaces consecutive whitespace characters with a single space and trims leading and trailing whitespace. Returns null if input is null, empty, or whitespace-only.
      Parameters:
      input - the string to normalize
      Returns:
      the normalized string, or null if input is blank or null