Left-most position of a letter in a string
POSALPHA( <cString>, [<lMode>], [<nIgnore>] ) -> nPosition
<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).
The value returned is the position of the first alphabetic character in <cString>. If no alphabetic character is located, the function returns 0.
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 Harbour 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.
. 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.
cString := "UKLM123" ? POSALPHA(cString) // Result: 1 ? POSALPHA(cString, .T.) // Result: 5 ? POSALPHA(cString, .F., 2) // Result: 3
POSALPHA() is compatible with CT3’s POSALPHA().
Source is pos1.c, library is libct.
POSLOWER(), POSUPPER(), POSRANGE()