comparison man/lispref/objects.texi @ 3543:c136144fe765

[xemacs-hg @ 2006-08-04 22:55:04 by aidan] Raw strings, from Python via SXEmacs
author aidan
date Fri, 04 Aug 2006 22:55:19 +0000
parents 84ee3ca77e7f
children dc697b1b786f
comparison
equal deleted inserted replaced
3542:1ce31579a443 3543:c136144fe765
1077 The printed representation of a string consists of a double-quote, the 1077 The printed representation of a string consists of a double-quote, the
1078 characters it contains, and another double-quote. However, you must 1078 characters it contains, and another double-quote. However, you must
1079 escape any backslash or double-quote characters in the string with a 1079 escape any backslash or double-quote characters in the string with a
1080 backslash, like this: @code{"this \" is an embedded quote"}. 1080 backslash, like this: @code{"this \" is an embedded quote"}.
1081 1081
1082 An alternative syntax allows insertion of raw backslashes into a
1083 string, like this: @code{#r"this \ is an embedded backslash"}. In such
1084 a string, each character following a backslash is included literally in
1085 the string, and all backslashes are left in the string. This means that
1086 @code{#r"\""} is a valid string literal with two characters, a backslash and a
1087 double-quote. It also means that a string with this syntax @emph{cannot end
1088 in a single backslash}. As with Python, from where this syntax was
1089 taken, you can specify @code{u} or @code{U} after the @code{#r} to
1090 specify that interpretation of Unicode escapes should be done.
1091
1082 The newline character is not special in the read syntax for strings; 1092 The newline character is not special in the read syntax for strings;
1083 if you write a new line between the double-quotes, it becomes a 1093 if you write a new line between the double-quotes, it becomes a
1084 character in the string. But an escaped newline---one that is preceded 1094 character in the string. But an escaped newline---one that is preceded
1085 by @samp{\}---does not become part of the string; i.e., the Lisp reader 1095 by @samp{\}---does not become part of the string; i.e., the Lisp reader
1086 ignores an escaped newline while reading a string. 1096 ignores an escaped newline while reading a string.