STRING.getCharAt

Returns the character at the specified position.

Syntax

getCharAt( position INTEGER )
       RETURNING result CHAR(1)
  1. position is the position of the character int the string.

Usage

This method extracts the character at the specified position from the STRING variable.

If the STRING variable is NULL, or if the position is out of the bounds of the string, the result will be NULL.

Important: When using byte length semantics, the position is expressed in bytes, and when using char length semantincs, position is specified in characters. In byte length semantics, the method returns NULL if the position does not match a valid character-byte index in the current string.

Example

MAIN
  DEFINE s STRING
  LET s = "Some text"
  DISPLAY s.getCharAt(4)
END MAIN