Harbour Reference Guide

 

GT_ASCPOS()

Return the ascii value of a specified character in a string

Syntax

GT_Ascpos(<cStr>, <nPos>) --> nAscVal

Arguments

<cStr> - The string <nPos> - The position in <cStr>

Returns

<nAscVal> - The ascii value of substr(<cStr>, <nPos>, 1)

Description

Return the ascii value of a specified character in a string Equivalent (but much faster) to asc(substr(cStr, nPos, 1)

NOTE: invalid parameters will return -1 nPos > len(cStr) will return -2

This last behaviour is different to the Funcky function of the same name. I changed the behaviour because some of the strings I process contain embedded NULs.
Examples
       ? gt_ascpos("the cat sat on the mat", 3) // prints e
Status

Ready

Files

Library is libgt

 




[Source Forge]

Other Docs Categories

Advantage Database RDD
Array
Binary conversion
Classes
Code Block
Console input
Conversion
Conversion Tools
DOS
Data input and output
Database
Database Tools
Date
Dos Tools
Environment
Error recovery
Events
File management
GT
Harbour Tools
Internal
Low Level
Math
Misc
Miscellaneous
Nation
Object manipulation
Operating System Specific
Parameter Checks
String Tools
Strings
TBrowse Method
TBrowse class
Terminal
Time
Utility
Variable Management

 

Last updated on 2001/07/30