Class BlueMindText

java.lang.Object
org.exoplatform.bluemind.client.util.BlueMindText

public final class BlueMindText extends Object
The few text helpers the client needs, so that it depends on the JDK alone rather than on commons-lang3 — the copied classes used StringUtils for exactly these four.
  • Method Details

    • isBlank

      public static boolean isBlank(String text)
      Whether a text is null, empty or only whitespace.
      Parameters:
      text - the text, possibly null
      Returns:
      true when there is nothing in it
    • trimToNull

      public static String trimToNull(String text)
      A text trimmed, or null when nothing is left.
      Parameters:
      text - the text, possibly null
      Returns:
      the trimmed text, or null when it was null or blank
    • defaultIfNull

      public static String defaultIfNull(String text, String replacement)
      A text, or a replacement when it is null.
      Parameters:
      text - the text, possibly null
      replacement - what to answer instead of null
      Returns:
      the text, or the replacement
    • substringBefore

      public static String substringBefore(String text, String separator)
      What precedes the first occurrence of a separator, or the whole text when it holds none.
      Parameters:
      text - the text
      separator - the separator
      Returns:
      the part before the separator