[<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
 ATADJUST()
 Adjusts the beginning position of a sequence within a string
------------------------------------------------------------------------------
 Syntax

     ATADJUST(<cSearchFor>,<cString>,<nEndpoint>,
        [<nCounter>],[<nIgnore>],[<nCharacter|
        <cCharacter>]) --> cString

 Arguments

     <cSearchFor>  Designates the character string for which the function
     searches, or the character string that provides the reference point for
     adjustment.

     <cString>  Designates the character string within which the
     adjustment occurs.

     <nTargetPosition>  Designates from which position within the
     character string the search expression is adjusted.

     <nCounter>  Designates which occurrence of the <Searchexpression> is
     taken into account.  The default value is for the last occurrence.

     <nIgnore>  Designates the number of characters at the beginning of
     the search string that are removed.  The default value is none.

     <nCharacter|cCharacter>  Designates a character, as necessary, to
     carry out the adjustment.  It can be an individual character or an ASCII
     value between 0 and 255.  The default value is a space CHR(32).

 Returns

     ATADJUST() returns the modified character string.

 Description

     The function first looks for the <cSearchFor> parameter within the
     character string.  From this point, the rest of the <cString> is moved
     (adjusted) by either inserting or removing blanks until the
     <nTargetPosition> is reached.  In lieu of blanks, <nCharacter>|
     <cCharacter> can be used as a fill character.

     Additionally you can specify that the nth occurrence of <cSearchFor> be
     used and whether or not a specific number of characters at the beginning
     of the search string is eliminated.

 Note

     .  Using CSETATMUPA() can influence how the search is performed.
        Using SETATLIKE() permits the use of wild cards within the search
        sequence.

 Examples

     .  Align comments at column 60.  The search is for the first
        occurrence of "//".  Since there is usually at least one space before
        each "//", search for " //":

        ? ATADJUST(" //", Line, 60, 1)

     .  Move the extensions for the following list of file names to
        position 10 and eliminate the ".":

        WINDOW.DBF
        PLZ.DBF
        BACK.DBF
        HELP.DBF
        LOG.DBF

        CHARREM(".", ATADJUST(".", File, 10))

        WINDOW      DBF

        PLZ         DBF
        BACK        DBF
        HELP        DBF
        LOG         DBF

     .  Use ATADJUST() with CSETATMUPA().  There is always a problem
        determining whether "AA" occurs twice or three times in "AAA".
        Depending on CSETATMUPA(), the function searches behind the last
        character, or starts from the last character of a located sequence:

        CSETATMUPA(.F.)
        ? ATADJUST("AA", "123AAABBB", 7, 2)       // Sequence not found

        CSETATMUPA(.T.)
        ? ATADJUST("AA", "123AAABBB", 7, 2)       // "123A  AABBB"


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