Add `byteAt(index)`, `codePointAt(index)`, and `bytes` sequence to String, enabling direct byte-level manipulation of UTF-8 encoded strings. Introduce `\x` hex escape sequence in string literals for specifying raw byte values. Refactor Unicode escape parsing into a generic `readHexEscape` function supporting variable digit counts. Implement `wrenUtf8Decode` utility for decoding UTF-8 sequences from byte buffers. Add comprehensive tests for `byteAt` including boundary conditions and error cases.
7 lines
166 B
Plaintext
7 lines
166 B
Plaintext
// Bytes: 11111
|
|
// 012345678901234
|
|
// Chars: sø mé ஃ thî ng
|
|
var s = "søméஃthîng"
|
|
|
|
IO.print(s.bytes is StringByteSequence) // expect: true
|