Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- FUNCky - <b>name:</b> <b>wildcard() - do wild card searches in strings</b> http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
  Name:     wildcard() - do wild card searches in strings
  Usage:    <logical> = wildcard(<pattern>,<string>)
  Params:   string <pattern> - the pattern to search for in <string>,
            it can contain * and ? characters, used just like in a
            DOS command (sort of).
            string <string> - the string to search in.

  Returns:  .T. if the pattern in <pattern> is found in <string>,
            otherwise it returns .F.

 ---------------------------------- Example ---------------------------------

                   ? wildcard("*","this is a test")
                   ** prints .T.
                   ? wildcard("*test","this is a test")
                   ** prints .T.
                   ? wildcard("*is*","this is a test")
                   ** prints .T.
                   ? wildcard("D?G","DOG")
                   ** prints .T.
                   ? wildcard("D?G","DIG")
                   ** prints .T.
                   ? wildcard("*is?????test","this is a test")
                   ** prints .T.
                   ? wildcard("*broke*leg*","the dog broke it's leg")
                   ** prints .T.

                   mem1 = space(20)
                   @ 10,0 say "Enter Search String: " get mem1
                   read

                   if (chrfound("?",mem1) .or. chrfound("*",mem1))
                           locate for wildcard(trim(mem1),trim(fname))
                   else
                           locate for (trim(mem1)=trim(fname))
                   endif

  Note:     wildcard() operates similar to the way DOS expands
            wild cards in filenames. It can be used to enhance the
            locating abilities of your application.

See Also: strcount() stratnext() chrfound() chrswap()

Online resources provided by: http://www.X-Hacker.org --- NG 2 HTML conversion by Dave Pearson