Text

The Text Data Type is used to represent a string of text. In addition to being the most common Data Type applied when displaying text to users, it can also be used to represent subcategories of strings that do not have their own official type, such as color codes or timezones.

#Structure

Airscript represents Text as a string. In order to enter a string into an Airscript Expression, the text must be enclosed by double quotes. Also, once enclosed in quotation marks, Text can include any character on the English keyboard.

Examples

To create a Text Variable containing the string "The quick brown fox", write the Airscript Expression as follows:

"The quick brown fox"

Dynamic content can also be embeded inside Text Variables since they support embedding the result of an arbitrary Airscript Expression by enclosing it inside {{ and }}. This is called Text Interpolation. For example, for a variable named count that contains a number, you can embed the value of that Variable this way:

"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 ():

"\"Airkit is the coolest\" said Mary."

This is done 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 escape sequences.

EscapeOuput

"

A double quote character '"'

\

A backslash character ''

A newline

A carriage return

\v

A vertical tab

A horizontal tab

\b

A backspace

\f

A form feed

{{

The characters '{{'

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

Last updated