The Text Variable Data Type The Text Variable Data Type

The Text Variable Data Type

Adam Evans Adam Evans


The text variable data type is used to represent just that, text. You'll find many uses for the
text type including displaying text in a Label, capturing data from users
such as their phone number or email address, or representing data types that do
not exist such as a color.

A String literal can be entered into an Airscript expression by enclosing the
text inside double quotes. For example to create a text variable containing the string
"The quick brown fox" one would write the Airscript expression as
"The quick brown fox"
There are times when one might want to embed dynamic content inside a text variable.
Text variable literals support embedding the result of an arbitrary Airscript
expression by enclosing the expression inside {{ and }}. This is called
Text Interpolation. For example, if one has a variable named count that
contains a Number one can embed the value of that variable like so:
"The count is: \{{FORMAT_NUMBER(count, "#")}}"
In order to create a text literal that contains a double quote, '"' it is
necessary to escape the double quote by preceding it with a backslash '\'. For
"\"Airkit is the coolest\" said Mary."
This is needed to differentiate a double quote that should be a part of the
Text content vs a double quote that marks the end of the string. In addition
to \" Airscript supports the following additional escape sequences.
Escape Output
\" A double quote character '"'
\\ A backslash character '\'
\n A newline
\r A carriage return

A vertical tab


A horizontal tab


A backspace


A form feed


The characters '\{{'

Internally, Text is stored as random access sequences of UTF-16 code points. For many
characters this means that each character takes up one slot in the string.
However, some characters may take two slots. For example the emoji the grinning
face emoji '😃' has a length of two rather one.

Was this article helpful?

0 out of 0 found this helpful

Add comment

Please sign in to leave a comment.