Class TextTools

java.lang.Object
rife.bld.extension.tools.TextTools

public final class TextTools extends Object
Utility methods for working with text and character sequences.

Provides null‑safe checks for blankness and emptiness across CharSequence and general Object inputs, along with a whitespace‑insensitive equality comparison. All operations avoid unnecessary allocations and optimize for String instances where possible.

Since:
1.0
Author:
Erik C. Thauvin
  • Method Summary

    Modifier and Type
    Method
    Description
    static boolean
    Compares two or more character sequences by removing all whitespace.
    static boolean
    Checks if a character sequence is null, empty, or contains only whitespace characters.
    static boolean
    isBlank(CharSequence... strings)
    Checks if all character sequences are null, empty, or contain only whitespace characters.
    static boolean
    isBlank(Object... strings)
    Checks if all string objects are null, empty, or contain only whitespace characters.
    static boolean
    Checks if a character sequence is null or empty.
    static boolean
    isEmpty(CharSequence... strings)
    Checks if all character sequences are null or empty.
    static boolean
    isEmpty(Object... strings)
    Checks if all string objects are null or their string representations are empty.
    static boolean
    Checks if a character sequence is not null, not empty, and not whitespace-only.
    static boolean
    Checks if all character sequences are not null, not empty, and not whitespace-only.
    static boolean
    isNotBlank(Object... strings)
    Checks if all string objects are not null, not empty, and not whitespace-only.
    static boolean
    Checks if a character sequence is not null and not empty.
    static boolean
    Checks if all character sequences are not null and not empty.
    static boolean
    isNotEmpty(Object... strings)
    Checks if all string objects are not null and their string representations are not empty.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Method Details

    • equalsIgnoreWhitespace

      public static boolean equalsIgnoreWhitespace(@Nullable CharSequence... strings)
      Compares two or more character sequences by removing all whitespace.
      Parameters:
      strings - the character sequences to compare
      Returns:
      true if all character sequences are equivalent when whitespace is ignored, false otherwise
      Since:
      1.0
    • isBlank

      public static boolean isBlank(@Nullable CharSequence str)
      Checks if a character sequence is null, empty, or contains only whitespace characters.
      Parameters:
      str - the character sequence to check
      Returns:
      true if the character sequence is null, empty, or whitespace-only; false otherwise
      Since:
      1.0
    • isBlank

      public static boolean isBlank(@Nullable CharSequence... strings)
      Checks if all character sequences are null, empty, or contain only whitespace characters.
      Parameters:
      strings - the character sequences to check
      Returns:
      true if all character sequences are null, empty, or whitespace-only; false otherwise
      Since:
      1.0
    • isBlank

      public static boolean isBlank(@Nullable Object... strings)
      Checks if all string objects are null, empty, or contain only whitespace characters.
      Parameters:
      strings - the string objects to check
      Returns:
      true if all string objects are null, their string representations are empty, or their string representations are whitespace-only; false otherwise
      Since:
      1.0
    • isEmpty

      public static boolean isEmpty(@Nullable CharSequence str)
      Checks if a character sequence is null or empty.
      Parameters:
      str - the character sequence to check
      Returns:
      true if the character sequence is null or empty; false otherwise
      Since:
      1.0
    • isEmpty

      public static boolean isEmpty(@Nullable CharSequence... strings)
      Checks if all character sequences are null or empty.
      Parameters:
      strings - the character sequences to check
      Returns:
      true if all character sequences are null or empty; false otherwise
      Since:
      1.0
    • isEmpty

      public static boolean isEmpty(@Nullable Object... strings)
      Checks if all string objects are null or their string representations are empty.
      Parameters:
      strings - the string objects to check
      Returns:
      true if all objects are null or their string representations are empty; false otherwise
      Since:
      1.0
    • isNotBlank

      public static boolean isNotBlank(@Nullable CharSequence str)
      Checks if a character sequence is not null, not empty, and not whitespace-only.
      Parameters:
      str - the character sequence to check
      Returns:
      true if the character sequence is not null, not empty, and not whitespace-only; false otherwise
      Since:
      1.0
    • isNotBlank

      public static boolean isNotBlank(@Nullable CharSequence... strings)
      Checks if all character sequences are not null, not empty, and not whitespace-only.
      Parameters:
      strings - the character sequences to check
      Returns:
      true if all character sequences are not null, not empty, and not whitespace-only; false otherwise
      Since:
      1.0
    • isNotBlank

      public static boolean isNotBlank(@Nullable Object... strings)
      Checks if all string objects are not null, not empty, and not whitespace-only.
      Parameters:
      strings - the string objects to check
      Returns:
      true if all objects are not null, their string representations are not empty, and their string representations are not whitespace-only; false otherwise
      Since:
      1.0
    • isNotEmpty

      public static boolean isNotEmpty(@Nullable CharSequence str)
      Checks if a character sequence is not null and not empty.
      Parameters:
      str - the character sequence to check
      Returns:
      true if the character sequence is not null and not empty; false otherwise
      Since:
      1.0
    • isNotEmpty

      public static boolean isNotEmpty(@Nullable CharSequence... strings)
      Checks if all character sequences are not null and not empty.
      Parameters:
      strings - the character sequences to check
      Returns:
      true if all character sequences are not null and not empty; false otherwise
      Since:
      1.0
    • isNotEmpty

      public static boolean isNotEmpty(@Nullable Object... strings)
      Checks if all string objects are not null and their string representations are not empty.
      Parameters:
      strings - the string objects to check
      Returns:
      true if all string objects are not null and their string representations are not empty; false otherwise
      Since:
      1.0