[<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
 LIKE()
 Compares character strings using wildcard characters
------------------------------------------------------------------------------
 Syntax

     LIKE(<cString1>,<cString2>) --> lEqual

 Arguments

     <cString1>  Designates the wildcard string for comparison.  All
     wildcards must be in this character string.

     <cString2>  Designates the string to compare to <cString1>.

 Returns

     LIKE() returns .T. when, after taking wildcards into account, both
     character strings are equal.

 Description

     This function allows you to compare two character strings with one
     another, where the first can contain wildcard characters.  This is
     similar to the way wildcard characters are used in conjunction with DOS
     commands but not identical.  Any single character matches a "?" in the
     first string (see examples).  The "*" within <cString1> can be placed
     anywhere and matches multiple characters.  You can also use multiple
     "*".

 Note

     .  You can also use wildcard characters in conjunction with an
        array of other string functions by using the SETATLIKE() switch, but
        only for the "?".

 Examples

     .  This example shows differences from DOS:

        Dir XYZ?.DBF                     // shows XYZ.DBF and XYZ1.DBF

        ? LIKE("XYZ?", "XYZ")            // .F.
        ? LIKE("XYZ?", "XYZ1")           // .T.

     .  This example shows other combinations:

        ? LIKE("*OG.*", "PROG.PRG")      // .T.
        ? LIKE("*OG.*", "LOG.PRG")       // .T.
        ? LIKE("*R*T*", "PROTO")         // .T.
        ? LIKE("*R*T*?", "PROTO")        // .F.
        ? LIKE("*R*T*?", "PROTO2")       // .T.

     .  Use wildcards in the first parameter only:

        ? LIKE("*PER", "CLIPPER")        // .T.
        ? LIKE("CLIPPER", "*PER")        // .F.


See Also: SETATLIKE()
This page created by ng2html v1.05, the Norton guide to HTML conversion utility. Written by Dave Pearson