"
Factor documentation > Factor handbook > The language > Syntax > Literals > Character and string syntax
Prev:CHAR:
Next:Character escape codes


Vocabulary
syntax

Syntax
"string..." """string..."""


Inputs and outputs
stringliteral and escaped characters


Word description
Reads from the input string until the next occurrence of " or """, and appends the resulting string to the parse tree. String literals can span multiple lines. Various special characters can be read by inserting Character escape codes. For triple quoted strings, the double-quote character does not require escaping.

Examples
A string with an escaped newline in it:
USE: io "Hello\nworld" print
Hello world

A string with an actual newline in it:
USE: io "Hello world" print
Hello world

A string with a named Unicode code point:
USE: io "\u{greek-capital-letter-sigma}" print
Σ

A triple-quoted string:
USE: io """Teach a man to "fish"... and fish will go extinct""" print
Teach a man to "fish"... and fish will go extinct


Definition
USING: sequences strings.parser ;

IN: syntax

SYNTAX: " parse-multiline-string suffix! ;