string
A string represents an immutable sequence of Unicode characters. Strings are used for textual data, identifiers, labels, and human-readable values. They are first-class values and integrate naturally with records, tuples, tables, maps, and comprehensions.
Syntax
String literals are written using double quotes ".
Strings may contain spaces and punctuation. Whitespace inside a string literal is preserved.
Escape sequences may be used for special characters:
"line 1\nline 2" "quote: \"" "tab\tseparated" "backslash: \\"
When rendered:
Raw string literals can be created using triple double quotes """. In this form, escape sequences are not processed, and all characters are taken literally, including backslashes and quotes.
"""C:\Users\Name\Documents""" """This is a "raw" \string\ literal."""
When rendered:
Kind
Strings have the kind:
All string values share the same kind regardless of length or contents.
Construction
Strings can be constructed in the following ways:
String literals
Results of string operations
Conversion from other kinds
String Literals
String literals are written using double quotes " and may contain escape sequences and newlines:
Raw string literals are written with triple quotes and can contain unescaped characters, as well as newlines:
String Concatenation
Strings can be concatenated using the + operator:
String concatentation is broadcast element-wise over matrices of strings:
If both operands are matrices of strings, they must have compatible dimensions:
Conversion to String
All values can be converted to strings explicitly.
Use <[string]> to create a matrix of strings:
This converts a <[f64]:1,4> (row matrix of floats) to a <[string]:2,2> (square matrix of strings).