xHarbour Reference Documentation > Function Reference xHarbour Developers Network  

PosAlpha()

Returns the position of the first alphabetic characters in a character string.

Syntax

PosAlpha( <cString>   , ;
         [<lNoAlpha>] , ;
         [<nSkipChars>] ) --> nPos

Arguments

<cString>
This is the character string to search for the first matching charatcer.
<lNoAlpha>
This parameter defaults to .F. (false) so that the first alphabetic character is searched. Passing .T. (true) instructs the function to search for the first non-alphabetic character.
<nSkipChars>
This numeric parameter defaults to 0 so that the function begins searching with the first character of <cString>. Passing a value > 0 instructs the function to ignore the first <nSkipChars> characters in the search.

Return

Depending on <lNoAlpha>, the function returns the position of the first (non)alphabetic character in <cString> as a numeric value.

Info

See also:PosLower(), PosRange(), PosUpper()
Category: CT:String manipulation , Character functions
Source:ct\pos1.c
LIB:xhb.lib
DLL:xhbdll.dll

Example

// The example displays results of PosAlpha()

   PROCEDURE Main
      LOCAL cString := "January 18th, 2007"
      LOCAL nPos, cChr

      ? nPos := PosAlpha( cString )            // result:   1
      ? cChr := cString[ nPos ], ;             // result:   J   74
        Asc( cChr )

      ? nPos := PosAlpha( cString, .T. )       // result:   8
      ? cChr := cString[ nPos ], ;             // result:       32
        Asc( cChr )

      ? nPos := PosAlpha( cString, .F., nPos ) // result:  11
      ? cChr := cString[ nPos ], ;             // result:   t  116
        Asc( cChr )

   RETURN

Copyright © 2006-2007 xHarbour.com Inc. All rights reserved.
http://www.xHarbour.com
Created by docmaker.exe