CT_POSUPPER

 POSUPPER()
 Finds the position of the first upper case, alphabetic character
------------------------------------------------------------------------------
 Syntax

     POSUPPER(<cString>,[<lMode>],[<nIgnore>])
        --> nPosition

 Arguments

     <cString>  Designates the string that is searched.

     <lMode>  Designates how the function searches for the first upper
     case, alphabetic character.  The default value (.F.) searches for the
     first alphabetic character that would be changed by the Clipper
     function LOWER().

     <nIgnore>  Designates the number of characters at the beginning of
     the character string that are excluded from the search.  The default
     value excludes none (0).

 Returns

     The value returned corresponds to the position of the character located.
     When no matching character is found, the function returns 0.

 Description

     Starting from the beginning of the string, POSUPPER() searches for the
     first upper case, alphabetic character in the <cString> that corresponds
     to the first character that would be changed by the Clipper LOWER()
     function.  If <lMode> is .T., the function searches for the first non-
     alphabetic character that would not be changed by LOWER().  The
     <nIgnore> parameter can exclude a specific number of characters at the
     beginning of <cString>.

 Notes

     .  Characters located when the <lMode> parameter is .T. are not
        necessarily lower case, alphabetic characters.

     .  The function works in conjunction with the NATION module
        because different languages use different characters to represent
        their alphabets.

 Example

     cString  :=  "123abcUABC"

     ? POSUPPER(cString)                 // Result: 7
     ? POSUPPER(cString, .T.)            // Result: 1
     ? POSUPPER(cString, .F., 7)         // Result: 8

See Also: POSALPHA() POSLOWER() POSRANGE()

 

CT_POSREPL

 POSREPL()
 Replaces one or more characters from a certain position
------------------------------------------------------------------------------
 Syntax

     POSREPL(<cString>,<cReplacementstring>,
        [<nStartPos>]) --> cString

 Arguments

     <cString>  [@]  Designates the character string within which the
     particular characters are replaced.

     <cReplacementstring>  Designates a sequence of characters that,
     starting at <nStartPos>, replace a portion of <cString>.

     <nStartPos>  Designates from which character within <cString> the
     replacement starts.

 Returns

     POSREPL() returns the modified string.

 Description

     When you use POSREPL(), you can replace a range of characters within
     <cString> with another character string <cReplacementstring>.  The new
     characters are exchanged beginning at <nStartPos>.

 Notes

     .  When the <nStartPos> parameter is not specified, the
        <cReplacementstring> overwrites the end of the string (see examples).

     .  The return value of this function can be suppressed by
        implementing CSETREF() to save space in working memory.

 Examples

     .  Starting at position 3, replace three characters with "XXX":

        ? POSREPL("ABCDEFG", "XXX", 3)         // "ABXXXFG"

     .  Replace the last LEN(<cReplacementstring>) characters:

        ? POSREPL("ABCDEFG", "XXX")            // "ABCDXXX"

     .  The result can be longer than the character string passed.

        ? POSREPL("ABCDEF", "123", 5)          // "ABCD123"
        ? POSREPL("ABCDEF", "123", 6)          // "ABCDE123"

See Also: POSINS() POSDEL() CSETREF()

 

CT_POSRANGE

 POSRANGE()
 Determines the position of the first character within a given ASCII code
 range
------------------------------------------------------------------------------
 Syntax

     POSRANGE(<cCharacter1>,<cCharacter2>,<cString>,
        [<lMode>],[<nIgnore>]) --> nPosition

 Arguments

     <cCharacter1> and <cCharacter2>  Designate the first and the
     last character of the character range.

     <cString>  Designates the string within which to search for a
     character in the <cCharacter1> to <cCharacter2> range.

     <lMode>  Designates if the return value is within the specified
     range or outside of the range.  The default value (.F.) searches for the
     first character within the range.

     <nIgnore>  Designates the number of characters at the beginning of
     the character string that are excluded from the search.  The default
     value excludes none (zero).

 Returns

     The value returned corresponds to the position of the located character.
     If no character is found, the function returns 0.

 Description

     Beginning from the left, POSRANGE() searches for the first character in
     the range <cCharacter1> to <cCharacter2> within <cString>.  If <lMode>
     is specified as .T., then the function searches for the first character
     that is not in the specified range.  This way you could search for
     control characters within a string by specifying <cCharacter1> = CHR(0)
     and <cCharacter2> = CHR(31).

     The <nIgnore> parameter gives you the ability to exclude a particular
     number of characters at the beginning of the <cString> from the search.

 Examples

     .  Search for the first character in the character string cInput
        that is not a control character:

        cInput  :=  COM_READ(1)
        ? POSRANGE(CHR(0), CHR(31), cInput, .T.)

     .  Ignore the first 10 characters:

        ? POSRANGE(CHR(0), CHR(31), cInput, .T., 10)

See Also: POSALPHA() POSLOWER() POSUPPER() RANGEREPL()

 

CT_POSLOWER

 POSLOWER()
 Finds the position of the first lower case alphabetic character
------------------------------------------------------------------------------
 Syntax

     POSLOWER(<cString>,[<lMode>],[<nIgnore>])
        --> nPosition

 Arguments

     <cString>  Designates the string that is searched.

     <lMode>  Designates how the function searches for the first lower
     case alphabetic character.  The default value (.F.) searches for the
     first alphabetic character that can be changed by the Clipper
     function UPPER().

     <nIgnore>  Designates the number of characters at the beginning of
     the character string that are excluded from the search.  The default
     value excludes none (0).

 Returns

     The value returned corresponds to the position of the character located.
     When no matching character is found, the function returns 0.

 Description

     Starting from the beginning of the string, POSLOWER() searches for the
     first lower case alphabetic character in <cString>.  If <lMode> is .T.,
     the function searches for the first non-alphabetic character that would
     not be changed by UPPER().  The <nIgnore> parameter excludes a specific
     number of characters at the beginning of the <cString> from the search.

 Notes

     .  Characters located when the <lMode> parameter is designated as
        .T. are not necessarily upper case, alphabetic characters.

     .  The function works in conjunction with the NATION module
        because different languages use different characters to represent
        their alphabets.

 Example

     cString  :=  "123ABCuabc"

     ? POSLOWER(cString)                 // Result: 7
     ? POSLOWER(cString, .T.)            // Result: 1
     ? POSLOWER(cString, .F., 7)         // Result: 8

See Also: POSALPHA() POSUPPER() POSRANGE()

 

CT_POSINS

 POSINS()
 Inserts characters at a particular position within a string
------------------------------------------------------------------------------
 Syntax

     POSINS(<cString>,<cInsertstring>,[<nPosition>])
        --> cString

 Arguments

     <cString>  Designates the character string into which characters are
     inserted.

     <cInsertstring>  Designates the new characters that are inserted
     into <cString>.

     <nPosition>  Designates the position where the new characters are
     inserted within <cString>.  The default value inserts the characters in
     front of the last character.

 Returns

     POSINS() returns the string with the inserted characters.

 Description

     You can use POSINS() to insert characters into an existing character
     string.  The <cInsertstring> characters are inserted into the <cString>
     at the location specified by <nPosition>.

 Note

     .  The resulting character string is longer than the original, so
        this function cannot be called by reference.

 Examples

     .  Insert "123" at position 2:

        ? POSINS("abcdefgh", "123", 2)   // "a123bcdefgh"

     .  Insert "123" at position 8:

        ? POSINS("abcdefgh", "123", 8)   // "abcdefg123h"

     .  Give an erroneous position:

        ? POSINS("abcdefgh", "123", 10)  // "abcdefgh"

See Also: POSDEL() POSREPL()



CT_POSEQUAL

 POSEQUAL()
 Finds the first position at which two strings are the same
------------------------------------------------------------------------------
 Syntax

     POSEQUAL(<cString1>,<cString2>,[<nCompare>],
        [<nIgnore>]) --> nPosition

 Arguments

     <cString1> and <cString2>  Designate the two character strings
     that are compared.

     <nCompare>  Designates the number of characters that must be the
     same.  The default value is the length of the shorter string.

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

 Returns

     POSEQUAL() returns the position from which the two character strings are
     the same for <nCompare> characters.  If no corresponding agreement is
     found, the function returns 0.

 Description

     POSEQUAL() allows you to determine at which point two strings agree.
     The length of this agreement is represented by <nCompare>.  If not
     specified, <nCompare> defaults to the length of the shorter string.

     Additionally, the <nIgnore> parameter lets you specify a particular
     number of characters that are excluded from the start of the strings
     during the comparison.

 Examples

     .  In this example, there is no agreement to the end of the
        string:

        cString1   :=  "ABCDEFGHI"
        cString2   :=  "XYZDEKLMN"
        ? POSEQUAL(cString1, cString2)                  // Result: 0

     .  This example shows the agreement of at least two characters:

        ? POSEQUAL(cString1, cString2, 2)               // Result: 4

     .  This example shows a single character agreement and excludes
        the first four characters:

        ? POSEQUAL(cString1, cString2, 1, 4)            // Result: 5

See Also: POSDIFF()

 

CT_POSDIFF

 POSDIFF()
 Finds the first position from which two strings differ
------------------------------------------------------------------------------
 Syntax

     POSDIFF(<cString1>,<cString2>,[<nIgnore>])
        --> nPosition

 Arguments

     <cString1> and <cString2>  Designate the two character strings
     that are compared.

     <nIgnore>  Designates how many characters at the beginning of the
     character strings are excluded from the search.  The default value
     excludes none (0).

 Returns

     POSDIFF() returns the first position where <cString1> and <cString2>
     differ.  If both character strings are equal, then the function returns
     0.

 Description

     POSDIFF() compares two strings and determines from which position the
     first difference occurs.  The <nIgnore> parameter allows you to exclude
     a particular number of characters from the beginning of both character
     strings from the search.

 Note

     .  Character strings of different lengths can be compared with
        each other (see examples).

 Examples

     .  This example compares two strings of the same length:

        cString1  :=  "X23AB$/A"
        cString2  :=  "X23A8$/A"
        ? POSDIFF(cString1, cString2)           // Result: 5

     .  Two strings of different lengths can also be compared:

        ? POSDIFF("AB", "ABC")                  // Result: 3

See Also: POSEQUAL()