2013-11-24 10:45:07 -08:00
|
|
|
// Returns characters (as strings).
|
2014-01-05 12:27:12 -08:00
|
|
|
IO.print("abcd"[0]) // expect: a
|
|
|
|
|
IO.print("abcd"[1]) // expect: b
|
|
|
|
|
IO.print("abcd"[2]) // expect: c
|
|
|
|
|
IO.print("abcd"[3]) // expect: d
|
2013-11-24 10:45:07 -08:00
|
|
|
|
|
|
|
|
// Allows indexing backwards from the end.
|
2014-01-05 12:27:12 -08:00
|
|
|
IO.print("abcd"[-4]) // expect: a
|
|
|
|
|
IO.print("abcd"[-3]) // expect: b
|
|
|
|
|
IO.print("abcd"[-2]) // expect: c
|
|
|
|
|
IO.print("abcd"[-1]) // expect: d
|
2015-01-09 07:12:25 -08:00
|
|
|
|
|
|
|
|
// Make sure the string's internal buffer size is correct.
|
|
|
|
|
IO.print("abcd"[1] == "b") // expect: true
|