Strings

Single and double quotes are identical. Both support interpolation, escape sequences, and all string methods.

Basics

scratch.xs

Interpolation

Any expression inside { braces gets evaluated and embedded in the string. Escape a brace with \{ to suppress interpolation.

scratch.xs

Format specs

Add :spec after an interpolated expression to control formatting. The spec follows Python's mini-language: [fill][align][width][,][.prec][type].

scratch.xs

Raw strings

Prefix r to disable escape processing and interpolation. Useful for regex patterns and file paths.

scratch.xs

Triple-quoted strings

Use """ """ for multi-line strings. Indentation is preserved and interpolation still works. Prefix with r for raw triple-quoted.

scratch.xs

Color strings

Prefix c to embed ANSI terminal colors at parse time. The format is c"style;style;...;text" where the last segment is the text.

let err = c"bold;red;Error: something went wrong"
let ok  = c"green;Done"
println(err)
println(ok)

Common methods

scratch.xs