A string is a sequence of Unicode scalar values.
At runtime, strings are represented by dynamic arrays
of bytes using the UTF-8 encoding. Both the size in bytes (String.utf8ByteSize
) and in characters
(String.length
) are cached and take constant time. Many operations on strings perform in-place
modifications when the reference to the string is unique.
Constructor
String.ofByteArray
Fields
bytes : ByteArray
The bytes of the UTF-8 encoding of the string. Since strings have a special representation in
the runtime, this function actually takes linear time and space at runtime. For efficient access
to the string's bytes, use String.utf8ByteSize
and String.getUTF8Byte
.
isValidUTF8 : self.bytes.IsValidUTF8
The bytes of the string form valid UTF-8.