Next: , Previous: , Up: Strings   [Contents][Index]


14.3.3 String Indexing

Poke supports accessing the characters in a string using the array indexing notation. The indexes are in the [0,n] range, where n is the length of the string minus one. Note the length doesn’t include the null character, i.e. it is not possible to access the terminating null. Examples:

(poke) "foo"[0]
0x66UB
(poke) "foo"[1]
0x6fUB

If the passed index is less than zero or it is too big, an E_out_of_bounds exception is raised:

(poke) "foo"[-1]
unhandled out of bounds exception
(poke) "foo"[3]
unhandled out of bounds exception