string.at()

Get the character at a specified index of a String.

Signature

at(index: Number) => String

Description

Returns the UTF-16 character located at a zero-based offset index. The calling String isn’t changed.

Parameters

Parameter Type Required Description

index

Int

true

Zero-based index of the character to return. Must be less than the String's length.

Return value

Type Description

String

Character located at the specified index.

Examples

Return the character at index offset 9:

"HTTP/1.1 200 OK".at(9)
"2"
\