Class Strings

java.lang.Object
org.fest.swing.util.Strings

public final class Strings extends Object
Understands utility methods related to Strings.
  • Constructor Details

    • Strings

      private Strings()
  • Method Details

    • isDefaultToString

      public static boolean isDefaultToString(String s)
      Returns whether the given String is the default toString() implementation of an Object.
      Parameters:
      s - the given String.
      Returns:
      true if the given String is the default toString() implementation, false otherwise.
    • areEqualOrMatch

      public static boolean areEqualOrMatch(String pattern, String s)
      Indicates if the given Strings match. To match, one of the following conditions needs to be true:
      • both Strings have to be equal
      • s matches the regular expression in pattern
      Parameters:
      pattern - a String to match (it can be a regular expression.)
      s - the String to verify.
      Returns:
      true if the given Strings match, false otherwise.
    • match

      public static boolean match(Pattern p, String s)
      Indicates if the given String matches the given regular expression pattern.
      Parameters:
      p - the given regular expression pattern.
      s - the String to evaluate.
      Returns:
      true if the given String matches the given regular expression pattern, false otherwise. It also returns false if the given String is null.
      Throws:
      NullPointerException - if the given regular expression pattern is null.
    • match

      public static boolean match(Pattern p, CharSequence s)
      Indicates if the given CharSequence matches the given regular expression pattern.
      Parameters:
      p - the given regular expression pattern.
      s - the CharSequence to evaluate.
      Returns:
      true if the given CharSequence matches the given regular expression pattern, false otherwise. It also returns false if the given CharSequence is null.
      Throws:
      NullPointerException - if the given regular expression pattern is null.