Strings

In Gleam Strings can be written as text surrounded by double quotes.

"Hello, Gleam!"

They can span multiple lines.

"Hello
Gleam!"

Under the hood Strings are UTF-8 encoded binaries and can contain any valid unicode.

"๐Ÿ‘ฉโ€๐Ÿ’ป ใ“ใ‚“ใซใกใฏ Gleam ๐Ÿ’ซ"

Escape Sequences

Gleam supports common string escape sequences. Here's all of them:

SequenceResult
\nNewline
\rCarriage Return
\tTab
\"Double Quote
\\Backslash

For example to include a double quote (") character in a string literal it must be escaped by placing a backslash (\) character before it.

"Here is a double quote -> \" <-"

Similarly all backslash characters must be escaped:

// A Windows filepath C:\Users\Gleam
"C:\\Users\\Gleam"

// A Decorative border /\/\/\/\
"/\\/\\/\\/\\"