POSALPHA()

POSALPHA()

Left-most position of a letter 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 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.

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

Compliance

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

Platforms

All

Files

Source is pos1.c, library is libct.

Seealso

POSLOWER(), POSUPPER(), POSRANGE()

2 responses to “POSALPHA()

  1. Pingback: Harbour String Functions | Viva Clipper !

  2. Pingback: Harbour All Functions – P | Viva Clipper !

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.