baml.String$stream

A UTF-8 encoded string.

Reference version

Signature

class baml.String$stream

A UTF-8 encoded string.

Strings are immutable: every method here returns a new string rather than modifying self. Quoted strings may span multiple lines; backtick strings interpolate.

Positions are character (Unicode code point) offsets, never byte offsets. length, at, code_point_at, slice, index_of, and last_index_of all agree with each other, and all disagree with byte_length as soon as one character takes more than one UTF-8 byte. A method taking a position also accepts a negative one, counting from the end. Python's str indexes the same way; JavaScript indexes by UTF-16 unit and so can cut an emoji in half.

The is_* predicates ask whether every character has the property, so all of them are true on the empty string. The is_ascii_* family is false for any character at or above U+0080.

Source:<builtin>/baml/string.bamlbytes 0–0

Implementations

baml.Concrete for T

Source:<builtin>/baml/core.bamlbytes 747–779