Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
let example: Int = 42
"This is a conventional string with interpolation: \(example)"
#"This is a raw string with interpolation: \#(example)"#
##"This is a string with raw pound signs with interpolation \##(example)"##
##"This string does not need to escape # since it uses double sharps"##
// Conventional String literals
"In conventional string literals \"quotes\" and backslashes like \\ must be escaped"
// Raw String literal
#" In a raw string literal anything goes \u{2029} \n does not trigger a line break "Even double quotes" "#
#"""
This is totally a multi-lined string
no need to escape stuff like " or \n or \u{2028}
and string interpolation still works too: \#(2 + 2) is 5
"""#
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment