Strings
Strings are heap objects. Mnemonics that accept an existing string expect a register containing an ObjectRef to a String, unless described otherwise. See CandleVM string opcodes for conversion details.
| CASM mnemonic | CandleVM opcode | Operands | Behavior |
|---|---|---|---|
str_new | NewString | destination, "text" | Creates a string from a quoted UTF-8 literal. |
str_len | StringLen | destination, string | Writes the number of Unicode scalar values to destination. |
str_concat | StringConcat | destination, left, right | Concatenates two strings into a new string. |
str_from_chars | StringFromChars | destination, array | Builds a string from an array of characters. |
str_to_chars | StringToChars | destination, string | Creates an array containing the string's Unicode scalar values. |
str_from_bytes | StringFromBytes | destination, buffer | Decodes a buffer as UTF-8 into a new string. |
str_to_bytes | StringToBytes | destination, string | Copies a string's UTF-8 bytes into a new buffer. |
str_of | StringOf | destination, value | Formats a value as a new string. |
str_lowercase | StringLowercase | destination, string | Creates a lowercased string. |
str_uppercase | StringUppercase | destination, string | Creates an uppercased string. |
str_to_num | StringToNumber | destination, string | Parses a string as a number and stores the result. |