base.StringBuffer.getCharAt
Return the character at a specified position.
Syntax
getCharAt(
index INTEGER )
RETURNS STRING
- index is the character position in the string.
Usage
The getCharAt()
method
returns the character from the string buffer at the position that
you specify.
The first character position is 1.
The
method returns NULL
if the position is lower as 1 or greater as the length of the string.
Important: When using byte length semantics, the position is expressed in bytes. When
using char length semantics, the unit is characters.
This matters when using a multibyte locale such as UTF-8.
Example
MAIN
DEFINE buf base.StringBuffer
LET buf = base.StringBuffer.create()
CALL buf.append("abcdef")
DISPLAY buf.getCharAt(3)
END MAIN
Output:
c