Class SimpleWildcardTester


  • public final class SimpleWildcardTester
    extends java.lang.Object
    Implements an algorithm for very simple pattern matching in a string. There is only one feature: "*" may be used at the start or the end of the pattern to represent "one or more characters".
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static boolean testWildcard​(java.lang.String pattern, java.lang.String str)
      Returns whether a string matches a particular pattern.
      static boolean testWildcardIgnoreCase​(java.lang.String pattern, java.lang.String str)
      Returns whether a string matches a particular pattern.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • SimpleWildcardTester

        public SimpleWildcardTester()
    • Method Detail

      • testWildcard

        public static boolean testWildcard​(java.lang.String pattern,
                                           java.lang.String str)
        Returns whether a string matches a particular pattern.
        Parameters:
        pattern - the input pattern
        str - the string to test
        Returns:
        true if a match occurs; falseotherwise.
      • testWildcardIgnoreCase

        public static boolean testWildcardIgnoreCase​(java.lang.String pattern,
                                                     java.lang.String str)
        Returns whether a string matches a particular pattern. Both string and pattern are converted to lower case before pattern matching occurs.
        Parameters:
        pattern - the input pattern
        str - the string to test
        Returns:
        true if a match occurs; falseotherwise.