# 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