Skip to content

Instantly share code, notes, and snippets.

@Nirma
Last active April 27, 2019 09:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Nirma/c3a7264788a6e6d69e5f890deb78faa2 to your computer and use it in GitHub Desktop.
Save Nirma/c3a7264788a6e6d69e5f890deb78faa2 to your computer and use it in GitHub Desktop.
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