Viva Clipper !

ASCPos()

Advertisements

ASCPos()

ASCII value of a character at a certain position

Syntax

      ASCPos( <cString>, [<nPosition>] ) --> nAsciiValue

Arguments

<cString> is the processed string

[<nPosition>] is an optional position within <cString> Default: last position in <cString>

Returns

<nAsciiValue> the ASCII value of the character at the specified position

Description

The ASCPos() function returns the ASCII value of the character that can be found at the position <nPosition> in <cString>. If <nPosition> is larger than the length of <cString>, 0 is returned.

Examples

      ? ASCPos( "0123456789" ) // --> 57
      ? ASCPos( "0123456789", 1 ) // --> 48

Tests

      ASCPos( "0123456789" ) == 57
      ASCPos( "0123456789", 1 ) == 48
      ASCPos( "0123456789", 11 ) == 0  // <nPosition> to large !

Compliance

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

Platforms

All

Files

Source is asciisum.c, library is libct.

Seealso

VALPOS()

Advertisements

Advertisements