From 9ac2fd5e77ed70ac750ebc01f55a37fe36a98c89 Mon Sep 17 00:00:00 2001 From: "Steven G. Johnson" Date: Fri, 20 Nov 2015 16:08:38 -0500 Subject: [PATCH] document newline normalization in literal strings (#14073) --- doc/manual/strings.rst | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/doc/manual/strings.rst b/doc/manual/strings.rst index 53c3a10419fac..93ee66fcf785a 100644 --- a/doc/manual/strings.rst +++ b/doc/manual/strings.rst @@ -439,7 +439,7 @@ backslash: julia> print("I have \$100 in my account.\n") I have $100 in my account. -Triple-Quoted Strings Literals +Triple-Quoted String Literals ------------------------------ When strings are created using triple-quotes (``"""..."""``) they have some @@ -482,6 +482,12 @@ defining strings within code that is indented. For example: In this case the final (empty) line before the closing ``"""`` sets the indentation level. +Note that line breaks in literal strings, whether single- or triple-quoted, +result in a newline (LF) character ``\n`` in the string, even if your +editor uses a carriage return ``\r`` (CR) or CRLF combination to end lines. +To include a CR in a string, use an explicit escape ``\r``; for example, +you can enter the literal string ``"a CRLF line ending\r\n"``. + Common Operations -----------------