Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- Clipper Tools One Guide - <b>beforatnum()</b> http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
BEFORATNUM()

Syntax:     BEFORATNUM(<expC1>,<expC2>[,<expN1>][,<expN2>])

Arguments:  <expC1> is the string to search.
            <expC2> denotes the string to search for.
            <expN1> determines the occurrence of <expC1> required.
            <expN2> denotes the start position of the search in the
            string.

Returns:    A character string.
            The function will return all the  characters of the <expC2>
            string located in front of the sequence determined.  A null
            string is returned if it is not possible to find any
            corresponding sequence.

Usage:      This function will determine the initial position of the
            <expN1>th occurrence of <expC1> within the <expC2> string,
            and will return all the characters of the string in front of the
            first position of the sequence.  The function checks the
            setting of CSETATMUPA() and will produce different results
            accordingly.  When CSETATMUPA() is on (.T.)
            BEFORATNUM() will continue the search from the right
            character of the search string <expC1> to determine the
            <expN1>th occurrence of <expC1>.  If CSETATMUPA() is off
            (.F.) then the search will continue at the next character after
            the search string <expC1>.

Notes:      If no argument <expN1> is passed, then the function will
            determine the last appearance of the string <expC1>.  If no
            <expN2> argument is passed, then the function will start to
            search at the first character of <expC2>, otherwise <expN2>
            characters relative to the start of the string will be exempted
            from the search.

Library:    CT1.LIB


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

Examples:   * The last appearance of a sequence
            ? BEFORATNUM("ab","abcaddabe")              && "abcabd"

            * The first appearance of a sequence
            ? BEFORATNUM("ab","abcaddabe",1)            && ""

            * The first appearance of a sequence
            * where the first three characters are not
            * in the search.
            ? BEFORATNUM("ab","abcaddabe",1,3)          && "abc"

            * The third appearance of "xx" within a
            * string where the first four characters are
            * not considered.  Please note the different
            * results by the multipass mode.

            string = AxxBBBBxxCCCCxxxDxxEExx"

            CSETATMUPA(.T.)
            ? AFTERATNUM("xx",string,3,4)               && "AxxBBBBxxCCCCx"

            CSETATMUPA(.F.)
            ? AFTERATNUM("xx",string,3,4)               && "AxxBBBBxxCCCCxxxD"



See Also: CSETATMUPA()

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