

Operations dealing with index values, such as CodePointAtIndex, are available in two variants: codepoint-based indexing and byte-based indexing.īyte-based indexing is indicated by the ByteIndex-suffix or prefix in an operation’s name, otherwise indices are based on codepoints.įor example, the index parameter of CodePointAtIndex is codepoint-based, whereas CodePointAtByteIndex uses a byte-based index. Most of these operations provide a parameter boolean lazy, which allows the user to enable or disable lazy evaluation on a per-callsite basis. Some operations support lazy evaluation, such as lazy concatenation or lazy evaluation of certain string properties. Users should use the provided nodes where possible, as the static/instance methods are just shorthands for executing their respective node’s uncached version.Īll nodes are named Uncached.

TruffleString supports a plethora of string encodings, but is especially optimized for the most commonly used:Īll operations exposed by TruffleString are provided as an inner Node, and as static or instance methods. Language implementers are encouraged to use Truffle Strings as their language’s string type for easier interoperability and better performance.

Truffle Strings is Truffle’s primitive String type, which can be shared between languages.
