textSize (text -- size)
Inputs
text: Text object whose UTF-8 size is queried.
Outputs
size: UTF-8 code-unit count as Natx.
textSize counts UTF-8 bytes, not Unicode code points or displayed characters. Decoded-character splitting is provided by textSplit.
For known non-NIL Text, the result is a known Natx. For unknown Text, the result is still Natx, but its exact numeric value is unknown at compile time. Known NIL Text is invalid.
Example
{} () {} [
"你好" textSize printStack _:;
text: 0 ("") dynamic @; # an unknown Text
@text textSize printStack _:;
] "main" exportFunction
Expected Output During Compilation
6nx
Natx
See also
&builtin(prefix suffix -- text)Concatenates two known Text objects.LFbuiltin(-- lineFeed)Pushes a line-feed Text constant.attributebuiltin(attribute --)Consumes one known Text attribute string and produces nothing.textSplitbuiltin(text -- characterList)Splits known Text by decoded UTF-8 characters into one-character Text items. Empty text yields the empty Tuple().