This is an old revision of the document!
Strings
Strings are enclosed in double quotes (“ ”) and are UTF-8 encoded. As with the stock 50g ROM, use of the →STR
and STR→
are useful for converting other objects to strings and vice versa. Strings can be cancatenated by the plus (+) operator: “Hello ” “World!” +
yields the string “Hello World!”
.
Strings in newRPL are always Unicode NFC normalized for maximum compatibility with other devices. Strings imported from other devices should be NFC normalized for proper operation in newRPL. When the source device doesn't guarantee text in a normalized form, this can be done with the →NFC
command.
Commands for strings
The following table summarizes commands which can be applied to strings.
Command | Purpose | Example |
→UTF8 | Convert to Unicode UTF8 object | |
UTF8→ | Convert from Unicode UTF8 object | |
SIZE | ||
STRLEN | ||
STRLENCP | ||
POS | ||
POSREV | ||
NPOS | ||
NPOSREV | ||
REPL | ||
SREPL | ||
SUB | ||
HEAD | ||
TAIL | ||
TRIM | ||
RTRIM | ||
NTOKENS | ||
NTHTOKEN | ||
NTHTOKENPOS |