Strings
String literals are delimited by either single quotes (') or double quotes ("). Both forms are identical in behaviour.
"hello"
'world'
"It's a string"
'She said "hi"'
Escape Sequences
The following escape sequences are recognised within string literals:
| Sequence | Meaning |
|---|---|
\n | Newline |
\r | Carriage return |
\t | Tab |
\\ | Backslash |
\" | Double quote |
\' | Single quote |
\0 | Null character |
\uXXXX | Unicode code point (4 hex digits) |
No String Interpolation
Jyro does not support string interpolation. Use the + operator for concatenation:
var greeting = "Hello, " + name # Correct
# var greeting = "Hello, ${name}" # INCORRECT - not supported
When either operand of + is a string, the other operand is automatically converted to its string representation.
Regex Pattern Escaping
Jyro’s string escape processing consumes backslash sequences before the string reaches a regex function. This means \d, \w, and \s are not valid regex shortcuts in Jyro strings. Use character classes instead:
| Instead of | Use |
|---|---|
\d | [0-9] |
\w | [a-zA-Z0-9_] |
\s | [ \t\n\r] |
\. | [.] |
# INCORRECT - \d is consumed by string escaping
var num = RegexMatch(text, "\d+")
# CORRECT - character class reaches the regex engine intact
var num = RegexMatch(text, "[0-9]+")