blob: efea16996912ddfaacf02fe24ef0f8379ae96f9f [file] [log] [blame] [view]
Marcel van Lohuizen75cb0032019-01-11 12:10:48 +01001[TOC](Readme.md) [Prev](numberlit.md) [Next](bytes.md)
2
Marcel van Lohuizenaf0932f2019-01-11 13:03:56 +01003_JSON Sugar and other Goodness_
4
Marcel van Lohuizen75cb0032019-01-11 12:10:48 +01005# String Literals
6
Marcel van Lohuizen3eb3a3c2019-01-11 12:39:52 +01007CUE strings allow a richer set of escape sequences than JSON.
Marcel van Lohuizen75cb0032019-01-11 12:10:48 +01008
9CUE also supports multi-line strings, enclosed by a pair of triple quotes `"""`.
10The opening quote must be followed by a newline.
11The closing quote must also be on a newline.
12The whitespace directly preceding the closing quote must match the preceding
13whitespace on all other lines and is removed from these lines.
14
15Strings may also contain [interpolations](interpolation.md).
16
17<!-- CUE editor -->
18```
19// 21-bit unicode characters
20a: "\U0001F60E" // 😎
21
22// multiline strings
23b: """
24 Hello
25 World!
26 """
27```
28
29<!-- JSON result -->
30```json
31{
32 a: "😎"
33 b: "Hello\nWorld!"
34}
35```