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  //  to large !
      valpos ("1234x56789",5) == 0   // "x" is not a digit !
Status

Ready

Compliance

VALPOS() is compatible with CT3's VALPOS().

Platforms

All

Files

Source is asciisum.c, library is libct.

See Also