CT_AFTERATNUM

 AFTERATNUM()
 Returns the remainder of the string after the nth appearance of a sequence

 Syntax

     AFTERATNUM(<cSearchFor>,<cString>,[<nCounter>],
        [<nIgnore>]) --> cString

 Arguments

     <cSearchFor>  Designates the string for which the function searches.

     <cString>  Designates the string to search.

     <nCounter>  Designates which occurrence of <cSearchFor> within
     <cString> is found.  The default value specifies the last occurrence in
     the search expression.

     <nIgnore>  Designates the number of characters that are eliminated
     from the search.  The default value ignores none (0).

 Returns

     AFTERATNUM() returns the remainder of the <cString> string from the
     first character after the nth (<nCounter>) occurrence of <cSearchFor>.
     If the last character in the sequence located is also the last character
     in the string being searched, then a null string is returned.

 Description

     This function finds the nth (<nCounter>) occurrence of <cSearchFor>
     within <cString> and returns the remainder of the string from the first
     position behind the located sequence.

     In order to determine the nth (<nCounter>) occurrence of <cSearchFor>,
     AFTERATNUM() searches from the left for each instance of this sequence.
     If CSETATMUPA() is off, then the search is continued after the last
     character of the sequence most recently found.  Otherwise the search is
     continued after the first character of the sequence most recently found.

 Note

     .  Implementing SETATLIKE() allows you to use wild card
        characters within <cSearchFor>.

 Examples

     .  Search a string for the last appearance of "aa" in two
        different ways:

        CSETATMUPA(.T.)
        ? AFTERATNUM("aa", "aBaaBaaX")   // "X"

        CSETATMUPA(.F.)
        ? AFTERATNUM("aa", "aBaaBaaX")   // "aX"

     .  Search a string for the third existing "xx" within the string,
        where the first four characters are ignored!  Notice the differing
        results, depending on the multi-pass mode!

        String  := " AxxBBBBxxCCCCxxxDxxEExx"

        CSETATMUPA(.T.)
        ? AFTERATNUM("xx", String, 3, 4)   // "DxxEExx"

        CSETATMUPA(.F.)
        ? AFTERATNUM("xx", String, 3, 4)   // "EExx"

     .  Examples for SETATLIKE() can be found under the corresponding
        function description.

See Also: CSETATMUPA() SETATLIKE()

 

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.