POSUPPER()

POSUPPER()

Left-most position of an uppercase letter in a string

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 Harbour 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 Harbour 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

Compliance

POSUPPER() is compatible with CT3’s POSUPPER().

Platforms

All

Files

Source is pos1.c, library is libct.

Seealso

POSALPHA(), POSLOWER(), POSRANGE()

POSRANGE()

POSRANGE()

Left-most position of a character from a set in a string

Syntax

       POSRANGE( <cChar1>, <cChar2>, <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)

Compliance

POSRANGE() is compatible with CT3’s POSRANGE().

Platforms

All

Files

Source is pos1.c, library is libct.

Seealso

POSALPHA(), POSLOWER(), POSUPPER(), RANGEREPL()

POSLOWER()

POSLOWER()

Left-most position of a lowercase letter in a string

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 Harbour 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

Compliance

POSLOWER() is compatible with CT3’s POSLOWER().

Platforms

All

Files

Source is pos1.c, library is libct.

Seealso

POSALPHA(), POSUPPER(), POSRANGE()

String Functions

AddASCII

AfterAtNum

AllTrim
Asc

ASCIISum

ASCPos
At

AtAdjust

AtNum
AtRepl
AtToken

BeforAtNum

Chr

CharAdd
CharAnd
CharEven
CharHist
CharList
CharMirr
CharMix
CharNoList
CharNot
CharOdd
CharOne
CharOnly
CharOr
CharPix
CharRela
CharRelRep
CharRem
CharRepl
CharRLL
CharRLR
CharSHL
CharSHR
CharSList
CharSort
CharSub
CharSwap
CharWin
CharXOR

CountLeft
CountRight
Descend
Empty
hb_At
hb_RAt
hb_ValToStr
IsAlpha
IsDigit
IsLower
IsUpper

JustLeft
JustRight

Left
Len
Lower
LTrim

NumAt
NumToken
PadLeft
PadRight

PadC
PadL
PadR

POSALPHA
POSCHAR
POSDEL
POSDIFF
POSEQUAL
POSINS
POSLOWER
POSRANGE
POSREPL
POSUPPER

RangeRem
RangeRepl

RAt

RemAll

RemLeft
RemRight
ReplAll

Replicate

ReplLeft

ReplRight

RestToken

Right
RTrim

SaveToken

SetAtLike
Space
Str

StrDiff

StrFormat

StrSwap

StrTran
StrZero
SubStr

TabExpand
TabPack

Token

TokenAt
TokenEnd
TokenExit
TokenInit
TokenLower
TokenNext
TokenNum
TokenSep
TokenUpper

Transform
Trim
Upper
Val

ValPos
WordOne
WordOnly
WordRem
WordRepl
WordSwap

WordToChar


CT_POSALPHA

 POSALPHA()
 Determines the position of the first alphabetic character in a string
------------------------------------------------------------------------------
 Syntax

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

 Arguments

     <cString>  Designates the string that is searched.

     <lMode>  Designates how the function searches for the first
     alphabetic character in a string.  The default value (.F.) searches for
     the first alphabetic character.

     <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 is the position of the first alphabetic character in
     <cString>.  If no alphabetic character is located, the function returns
     0.

 Description

     Starting from the left, POSALPHA() searches for the first alphabetic
     character in <cString> that corresponds to the first character that can
     be changed by the Clipper LOWER() or UPPER() functions.  If <lMode>
     is .T., then the function searches for the first non-alphabetic
     character.  The <nIgnore> parameter can exclude a specific number of
     characters at the beginning of the <cString> from the search.

 Notes

     .  Notice that characters located when <lMode> is .T. are always
        numbers or special characters, but are never alphabetic characters.

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

 Example

     cString  :=  "UKLM123"
     ? POSALPHA(cString)                 // Result: 1
     ? POSALPHA(cString, .T.)            // Result: 5
     ? POSALPHA(cString, .F., 2)         // Result: 3

See Also: POSLOWER() POSUPPER() POSRANGE()

 

Tools – String Manipulations

Introduction 
ADDASCII()   Adds a value to each ASCII code in a string
AFTERATNUM() Returns remainder of a string after nth appearance of sequence
ASCIISUM()   Finds sum of the ASCII values of all the characters of a string
ASCPOS()     Determines ASCII value of a character at a position in a string
ATADJUST()   Adjusts the beginning position of a sequence within a string
ATNUM()      Determines the starting position of a sequence within a string
ATREPL()     Searches for a sequence within a string and replaces it
ATTOKEN()    Finds the position of a token within a string
BEFORATNUM() Returns string segment before the nth occurrence of a sequence
CENTER()     Centers a string using pad characters
CHARADD()    Adds the corresponding ASCII codes of two strings
CHARAND()    Links corresponding ASCII codes of paired strings with AND
CHAREVEN()   Returns characters in the even positions of a string
CHARLIST()   Lists each character in a string
CHARMIRR()   Mirrors characters within a string
CHARMIX()    Mixes two strings together
CHARNOLIST() Lists the characters that do not appear in a string
CHARNOT()    Complements each character in a string
CHARODD()    Returns characters in the odd positions of a string
CHARONE()    Reduces adjoining duplicate characters in string to 1 character
CHARONLY()   Determines the common denominator between two strings
CHAROR()     Joins the corresponding ASCII code of paired strings with OR
CHARPACK()   Compresses (packs) a string
CHARRELA()   Correlates the character positions in paired strings
CHARRELREP() Replaces characters in a string depending on their correlation
CHARREM()    Removes particular characters from a string
CHARREPL()   Replaces certain characters with others
CHARSORT()   Sorts sequences within a string
CHARSPREAD() Expands a string at the tokens
CHARSWAP()   Exchanges all adjoining characters in a string
CHARUNPACK() Decompresses (unpacks) a string
CHARXOR()    Joins ASCII codes of paired strings with exclusive OR operation
CHECKSUM()   Calculates the checksum for a character string (algorithm)
COUNTLEFT()  Counts a particular character at the beginning of a string
COUNTRIGHT() Counts a particular character at the end of a string
CRYPT()      Encrypts and decrypts a string
CSETATMUPA() Determines setting of the multi-pass mode for ATXXX() functions
CSETREF()    Determines whether reference sensitive functions return a value
EXPAND()     Expands a string by inserting characters
JUSTLEFT()   Moves characters from the beginning to the end of a string
JUSTRIGHT()  Moves characters from the end of a string to the beginning
LIKE()       Compares character strings using wildcard characters
LTOC()       Converts a logical value into a character
MAXLINE()    Finds the longest line within a string
NUMAT()      Counts the number of occurrences of a sequence within a string
NUMLINE()    Determines the number of lines required for string output
NUMTOKEN()   Determines the number of tokens in a string
PADLEFT()    Pads a string on the left to a particular length
PADRIGHT()   Pads a string on the right to a particular length
POSALPHA()   Determines position of first alphabetic character in a string
POSCHAR()    Replaces individual character at particular position in string
POSDEL()     Deletes characters at a particular position in a string
POSDIFF()    Finds the first position from which two strings differ
POSEQUAL()   Finds the first position at which two strings are the same
POSINS()     Inserts characters at a particular position within a string
POSLOWER()   Finds the position of the first lower case alphabetic character
POSRANGE()   Determines position of first character in an ASCII code range
POSREPL()    Replaces one or more characters from a certain position
POSUPPER()   Finds the position of the first uppercase, alphabetic character
RANGEREM()   Deletes characters that are within a specified ASCII code range
RANGEREPL()  Replaces characters within a specified ASCII code range
REMALL()     Removes characters from the beginning and end of a string
REMLEFT()    Removes particular characters from the beginning of a string
REMRIGHT()   Removes particular characters at the end of a string
REPLALL()    Exchanges characters at the beginning and end of a string
REPLLEFT()   Exchanges particular characters at the beginning of a string
REPLRIGHT()  Exchanges particular characters at the end of a string
RESTTOKEN()  Recreates an incremental tokenizer environment
SAVETOKEN()  Saves the incremental tokenizer environment to a variable
SETATLIKE()  Provides an additional search mode for all AT functions
STRDIFF()    Finds similarity between two strings (Levenshtein Distance)
STRSWAP()    Interchanges two strings
TABEXPAND()  Converts tabs to spaces
TABPACK()    Converts spaces in tabs
TOKEN()      Selects the nth token from a string
TOKENAT()    Determines the most recent TOKENNEXT() position within a string
TOKENEND()   Determines if more tokens are available in TOKENNEXT()
TOKENINIT()  Initializes a string for TOKENNEXT()
TOKENLOWER() Converts initial alphabetic character of a token into lowercase
TOKENNEXT()  Provides an incremental tokenizer
TOKENSEP()   Provides separator before/after most recently retrieved TOKEN()
TOKENUPPER() Converts the initial letter of a token into upper case
VALPOS()     Determines numerical value of character at particular position
WORDONE()    Reduces multiple appearances of double characters to one
WORDONLY()   Finds common denominator of 2 strings on double character basis
WORDREPL()   Replaces particular double characters with others
WORDSWAP()   Exchanges double characters lying beside each other in a string
WORDTOCHAR() Exchanges double characters for individual ones