ValPos()
Numerical value of a character at a certain position
Syntax
ValPos( <cString>, [<nPosition>] ) --> nDigitValue
Arguments
<cString> is the processed string [<nPosition>] is an optional position within <cString> Default: last position in <cString>
Returns
<nDigitValue> the numerical value of the character at the specified position
Description
The ValPos() function returns the numerical value of the character that can be found at the position <nPosition> in <cString>. If no digit can be found at this position or if <nPosition> is larger than the length of <cString>, 0 is returned.
Examples
? ValPos( "1234x56789" ) // --> 9 ? ValPos( "1234x56789", 1 ) // --> 1
Tests
ValPos( "1234x56789" ) == 9 ValPos( "1234x56789", 1 ) == 1 ValPos( "1234x56789", 11 ) == 0 // <nPosition> to large ! ValPos( "1234x56789", 5 ) == 0 // "x" is not a digit !
Compliance
ValPos() is compatible with CT3’s ValPos().
Platforms
All
Files
Source is asciisum.c, library is libct.
Seealso
ASCPOS()
Pingback: Harbour All Functions – V | Viva Clipper !
Pingback: Harbour String Functions | Viva Clipper !