ASCPos()

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

2 responses to “ASCPos()

  1. Pingback: Harbour String Functions | Viva Clipper !

  2. Pingback: Harbour All Functions – A | 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 )

Google photo

You are commenting using your Google 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 )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.