value is a sequence of characters: numbers, letters, punctuation, symbols, and whitespace.
In other programming languages, this type may be called "text" or "varchar".
Examples include "fish" and "entrée."
Emojis can be used, but the Windows console does not have the font support necessary to display them.
Terminals on macOS and Linux can display emojis.
Literal strings are written with double quotes around them, as shown below.
dim x as String
x = "foo bar"
print "hello world!"
TMBASIC supports Unicode
, a standard for representing world writing systems on computers.
Strings are stored in memory using the UTF-16
This means that each distinct element in a string is a 16-bit "code unit."
Either one or two 16-bit code units form a Unicode "code point."
Unicode assigns a code point number to every character, accent, and symbol.
In plain English text, a single letter or digit is one Unicode code point and is encoded in a single 16-bit code unit.
procedure will produce the character corresponding to a given code point number.
Some emojis, such as national flag emojis, are represented as a series of multiple code points.
Accents may be represented by multiple Unicode code points known as combining diacritical marks
The following example demonstrates how combining marks may appear in strings.
dim x = Chr(101)
dim y = Chr(769)
dim z = x + y
procedure returns the number of 16-bit code units in a string.
Keep in mind the caveats above about letters and symbols that are represented using multiple code points.
dim x = "hello"
dim y = Len(x)
Two strings can be combined (or "concatenated") using the +
dim x = "aaa"
dim y = "bbb"
print x + y