Skip to content

String Manipulation Opcodes ​

This section documents the strings instructions available in CandleVM.

For operand encodings, see the executable format reference.

Strings ​

String objects contain UTF-8 text.

Opcode byteOpcodeOperand bytesBehavior
50NewStringdestination: register, string: stringCreates a String from the UTF-8 text operand and stores its ObjectRef value.
51StringLendestination: register, string: registerStores the number of Unicode scalar values as a numeric value (Byte for lengths 0–255, otherwise Number).
52StringConcatdestination: register, left: register, right: registerConcatenates two ObjectRef values to a String and stores a newly allocated String. Other types or references to non-String objects fail.
53StringFromCharsdestination: register, array: registerBuilds and stores a String from an Array whose every element is a Char; a non-Char element raises ArrayTypeMismatch.
54StringToCharsdestination: register, string: registerAllocates an Array of Char values from the String's Unicode scalar values.
55StringFromBytesdestination: register, buffer: registerDecodes the entire buffer as UTF-8 and stores a string; invalid UTF-8 raises InvalidString.
56StringToBytesdestination: register, string: registerCopies the String's UTF-8 bytes into a newly allocated buffer.
57StringOfdestination: register, value: registerFormats a value as a string. ObjectRef values format the referenced heap object; other values use their runtime display representation. The result is allocated as a new String.
58StringLowercasedestination: register, string: registerConverts the String to lowercase using Unicode-aware casing and allocates the result as a new String.
59StringUppercasedestination: register, string: registerConverts the String to uppercase using Unicode-aware casing and allocates the result as a new String.
60StringToNumberdestination: register, string: registerParses a trimmed decimal or optionally signed hexadecimal String. Invalid input, NaN, and infinity raise InvalidNumber.

Built for the Candle ecosystem · Powered by VitePress.