String.char_at
String.char_at
Function
Read the character at the specified character position.
Syntax
string.char_at(index)
Parameters
| Parameters | Type | Required | Default value | Description |
|---|---|---|---|---|
| index | Int | No | 0 | Character subscript, negative numbers will be treated as 0. |
Return value
| Type | Description |
|---|---|
| String/Empty | Returns a single-character string when the subscript exists; returns Empty when out of bounds. |
Example
text = 'hello' result = text.char_at(1) // Output: e print result
Notes
- ASCII strings are read as byte subscripts; non-ASCII strings are read as Unicode character subscripts.