![]() ![]() Return a TruffleStringIterator object suitable for iterating the string’s codepoints, starting from the end of the ![]() ![]() Return a TruffleStringIterator object suitable for iterating the string’s codepoints. Read a single codepoint from a string at a given byte-based index. Read a single codepoint from a string at a given codepoint-based index. ![]() Use this node to avoid materialization code inside loops iterating over a string’s code points or bytes. Parse a string’s content as a double value. Parse a string’s content as a long value. Parse a string’s content as an int value. The hash code is based on the string’s bytes, so strings with the same codepoints butĭifferent encodings may have different hash codes.Ĭreate a string containing the same bytes as the given string, but assigned to the given encoding.Ĭonvert a MutableTruffleString to an immutable TruffleString.Ĭonvert a TruffleString backed by a native pointer to one backed by a java byte array.Ĭopy a string’s content into a byte array.Ĭopy a string’s content into a native pointer. Note that this operation is encoding-sensitive!Ĭheck if two strings are equal in a given region defined by a codepoint-based offset and length.Ĭheck if two strings are equal in a given region defined by a byte-based offset and length. Get coarse information about the string’s content, without taking 16/32-bit based encodings into account.Ĭheck whether a string’s code range equals the given code range.Ĭheck if a string is compatible to / can be viewed in a given encoding.Ĭheck if a string is not backed by a native pointer.Ĭheck if a string is backed by a native pointer.Ĭheck if a string is an instance of TruffleString.Ĭheck if a string is an instance of MutableTruffleString.Ĭheck if two strings are equal. Get coarse information about the string’s content (are all codepoints in this string from the ASCII/LATIN-1/BMP Get an empty TruffleString in that encoding.Ĭheck whether a string is encoded correctly. The list of currently available operations is listed below and grouped by category.Ĭreate a new TruffleString from a given codepoint.Ĭreate a new TruffleString from a given long value.Ĭreate a new TruffleString from a given byte array.Ĭreate a UTF-16 TruffleString from a given char array.Ĭreate a UTF-32 TruffleString from a given int array.Ĭreate a TruffleString from a given .Ĭreate a new TruffleString from a given native pointer. 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. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |