ValPos()

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()

Advertisements

2 responses to “ValPos()

  1. Pingback: Harbour All Functions – V | Viva Clipper !

  2. Pingback: Harbour String Functions | 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 )

Twitter picture

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

Facebook photo

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

Google+ photo

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

Connecting to %s