Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- CA-Clipper Tools . Books 1-3 - <b>setatlike()</b> http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
 SETATLIKE()
 Provides an additional search mode for all AT functions
------------------------------------------------------------------------------
 Syntax

     SETATLIKE([<nNewMode>,[<cCharacter>]]) --> nOldMode

 Arguments

     <nNewMode>  Designates which mode the AT functions and STRDIFF()
     should use during searches.  At this time, the 0 and 1 modes are
     permitted.  The default value is 0.

     <cCharacter>  Designates optional wildcard characters only.  The
     default value is "?".

     ()  When called without parameters, the function returns the current
     mode.

 Returns

     When a parameter is passed, the function returns the previous mode.  If
     no parameter is passed, the function returns the current mode.

 Description

     Generally speaking, all AT functions like ATNUM(), AFTERATNUM(), and the
     function STRDIFF(), operate to find an exact match during the execution
     of the search sequence.  When you use SETATLIKE(1), an additional mode
     can be selected which permits the use of wildcard characters.  For every
     position containing a wildcard character within the search expression,
     any character can occur in the character string that is searched.  The
     first character of the search expression cannot be a wildcard, and the
     entire expression cannot consist of wildcards.  These restrictions
     simultaneously avoid unwanted recursions with ATREPL().

     The customary "?" has been used as the default wildcard character.
     However, it can be replaced by using the optional <cCharacter>
     parameter.  Any character you choose can be set as a wildcard character,
     increasing the flexibility of this group of functions.

 Notes

     .  The DOS supported "*" wildcard character is not available for
        this function.

     .  The <nNewMode> parameter was selected to be a numeric value to
        allow future implementation of additional modes.

 Examples

     .  Set the SETATLIKE(1) wildcard mode to on:

        SETATLIKE(1)

     .  Determine the beginning position at the start of the last
        search expression:

        cTextsequence  := "ABCDEABC123AXCK"
        ? ATNUM("ABC", cTextsequence)                 // 6
        ? ATNUM("A?C", cTextsequence)                 // 12

     .  Determine if the search expression occurs with the text
        sequence:

        cTextsequence  := "ABCDEABC123AXCK"
        ? NUMAT("ABC", cTextsequence)                 // 2
        ? NUMAT("A?C", cTextsequence)                 // 3

     .  Determine the portion of the text sequence behind the last
        occurrence in the search expression:

        cTextsequence  := "ABCDEABC123AXCK"
        ? AFTERATNUM("ABC", cTextsequence)            // 123AXCK
        ? AFTERATNUM("A?C", cTextsequence)            // K

     .  Determine the portion of the text sequence before the last
        occurrence in the search expression:

        cTextsequence  := "ABCDEABC123AXCK"
        ? BEFOREATNUM("ABC", cTextsequence)           // ABCDE
        ? BEFOREATNUM("A?C", cTextsequence)           // ABCDEABC123

     .  Determine the portion of the text sequence from the last
        occurrence aligned at position 15:

        cTextsequence  := "ABCDEABC123AXCK"
        ? ATADJUST("ABC", cTextsequence, 15)          // ABCDE   ABC123AXCK
        ? ATADJUST("A?C", cTextsequence, 15)          // ABCDEABC123   AXCK

     .  ATREPL() poses an unusual situation.  If a search expression
        containing wildcard characters (like the one in the following
        example) is exchanged for a sequence where you only find other
        characters at the wildcard positions, a recursion occurs internally
        if CSETATMUPA() is on:

        CSETATMUPA(.T.)
        cTextsequence  := "ABCDEABC123AXCK"
        ? ATREPL("D?", cTextsequence, "DX")           // ABCDXXXXXXXXXXXX

     .  Wildcard characters reduce the valence with the STRDIFF()
        function:

        ? STRDIFF("ABC", "AXC")                       // Valence 3
        ? STRDIFF("A?C", "AXC")                       // Valence 0


See Also: ATADJUST() ATNUM() AFTERATNUM() BEFORATNUM()

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