Knowledge

String literal

Source ๐Ÿ“

2979:: "A long string can be continued across multiple lines by using the backslash-newline line continuation, but this practice requires that the continuation of the string start in the first position of the next line. To permit more flexible layout, and to solve some preprocessing problems (see ยง3.8.3), the Committee introduced string literal concatenation. Two string literals in a row are pasted together (with no null character in the middle) to make one combined string literal. This addition to the C language allows a programmer to extend a string literal beyond the end of a physical line without having to use the backslash-newline mechanism and thereby destroying the indentation scheme of the program. An explicit concatenation operator was not introduced because the concatenation is a lexical construct rather than a run-time operation." 1203:
problems. Escape sequences, however, solve every delimiter problem and most compilers interpret escape sequences. When an escape character is inside a string literal, it means "this is the start of the escape sequence". Every escape sequence specifies one character which is to be placed directly into the string. The actual number of characters required in an escape sequence varies. The escape character is on the top/left of the keyboard, but the editor will translate it, therefore it is not directly tapeable into a string. The backslash is used to represent the escape character in a string literal.
3014:: "The # operator has been introduced for stringizing. It may only be used in a #define expansion. It causes the formal parameter name following to be replaced by a string literal formed by stringizing the actual argument token sequence. In conjunction with string literal concatenation (see ยง3.1.4), use of this operator permits the construction of strings as effectively as by identifier replacement within a string. An example in the Standard illustrates this feature." 54:. Methods such as escape sequences can be used to avoid the problem of delimiter collision (issues with brackets) and allow the delimiters to be embedded in a string. There are many alternate notations for specifying string literals especially in complicated cases. The exact notation depends on the programming language in question. Nevertheless, there are general guidelines that most modern programming languages follow. 2327:(as well as Perl and Ruby), double-quoted (quotation-delimited, ") strings are interpolated, while single-quoted (apostrophe-delimited, ') strings are not. Non-interpolated string literals are sometimes referred to as "raw strings", but this is distinct from "raw string" in the sense of escaping. For example, in Python, a string prefixed with 1518:
When code in one programming language is embedded inside another, embedded strings may require multiple levels of escaping. This is particularly common in regular expressions and SQL query within other languages, or other languages inside shell scripts. This double-escaping is often difficult to read
2084:
Accordingly, it is not used in most languages, and it has been proposed for deprecation from D and Python. However, removing the feature breaks backwards compatibility, and replacing it with a concatenation operator introduces issues of precedence โ€“ string literal concatenation occurs during lexing,
135:
A number of languages provide for paired delimiters, where the opening and closing delimiters are different. These also often allow nested strings, so delimiters can be embedded, so long as they are paired, but still result in delimiter collision for embedding an unpaired closing delimiter. Examples
2529:
Using string literals as code that generates other code may have adverse security implications, especially if the output is based at least partially on untrusted user input. This is particularly acute in the case of Web-based applications, where malicious users can take advantage of such weaknesses
1187:
meaning "a quote; followed by zero or more of either an escaped character (backslash followed by something, possibly backslash or quote), or a non-escape, non-quote character; ending in a quote" โ€“ the only issue is distinguishing the terminating quote from a quote preceded by a backslash, which may
1157:
Escape sequences are a general technique for representing characters that are otherwise difficult to represent directly, including delimiters, nonprinting characters (such as backspaces), newlines, and whitespace characters (which are otherwise impossible to distinguish visually), and have a long
780:
for short), then an opening parenthesis (to denote the end of the eos id) is required. Then follows the actual content of the literal: Any sequence characters may be used (except that it may not contain a closing parenthesis followed by the eos id followed a quote), and finally โ€“ to terminate the
1660:
Two issues with multiline string literals are leading and trailing newlines, and indentation. If the initial or final delimiters are on separate lines, there are extra newlines, while if they are not, the delimiter makes the string harder to read, particularly for the first line, which is often
1202:
Among other things, it must be possible to encode the character that normally terminates the string constant, plus there must be some way to specify the escape character itself. Escape sequences are not always pretty or easy to use, so many compilers also offer other means of solving the common
1199:, converting the escaped string into the unescaped string that it represents. This is done during the evaluation phase of the overall lexing of the computer language: the evaluator of the lexer of the overall language executes its own lexer for escaped string literals. 1012:
Another option, which is rarely used in modern languages, is to use a function to construct a string, rather than representing it via a literal. This is generally not used in modern languages because the computation is done at run time, rather than at parse time.
2482:
Languages that lack flexibility in specifying string literals make it particularly cumbersome to write programming code that generates other programming code. This is particularly true when the generation language is the same or similar to the output language.
2100:(no escaping), or to disable or enable variable interpolation, but has other uses, such as distinguishing character sets. Most often this is done by changing the quoting character or adding a prefix or suffix. This is comparable to prefixes and suffixes to 1758:, which occurs at compile time, but in a later phase (after phrase analysis or "parsing"). Most languages, such as C#, Java and Perl, do not support implicit string literal concatenation, and instead require explicit concatenation, such as with the 95:
Some languages either allow or mandate the use of single quotations instead of double quotations (the string must begin and end with the same kind of quotation mark and the type of quotation mark may or may not give slightly different semantics):
1597:
sections allows use of characters such as & and < without an XML parser attempting to interpret them as part of the structure of the document itself. This can be useful when including literal text and scripting code, to keep the document
1785:
In practical terms, this allows string concatenation in early phases of compilation ("translation", specifically as part of lexical analysis), without requiring phrase analysis or constant folding. For example, the following are valid C/C++:
2052:
Implicit string concatenation is not required by modern compilers, which implement constant folding, and causes hard-to-spot errors due to unintentional concatenation from omitting a comma, particularly in vertical lists of strings, as in:
474:
class is frequently used in the same way a string literal would be used in other languages, and is often preferred to C-style strings for its greater flexibility and safety. But it comes with a performance penalty for string literals, as
1742:, where adjacent string literals are implicitly joined into a single literal at compile time. This is a feature of C, C++, D, Ruby, and Python, which copied it from C. Notably, this concatenation happens at compile time, during 2009:, making it simpler to split string literals across several lines, avoiding the need for line continuation (via backslashes) and allowing one to add comments to parts of strings. For example, in Python, one can comment a 939:
to delimit literal strings (initial newline stripped, otherwise raw), but the opening brackets can include any number of equal signs, and only closing brackets with the same number of signs close the string. For example:
2085:
prior to operator evaluation, but concatenation via an explicit operator occurs at the same time as other operators, hence precedence is an issue, potentially requiring parentheses to ensure desired evaluation order.
2835:, 2.2 Phases of translation , p. 17: "6. Adjacent string literal tokens are concatenated." and 2.14.5 String literals , note 13, p. 28โ€“29: "In translation phase 6 (2.2), adjacent string literals are concatenated." 1210:
inside string literals. Metacharacters have varying interpretations depending on the context and language, but are generally a kind of 'processing command' for representing printing or nonprinting characters.
189:). Unpaired marks are preferred for compatibility, as they are easier to type on a wide range of keyboards, and so even in languages where they are permitted, many projects forbid their use for source code. 1722:
Tcl allows literal newlines in strings and has no special syntax to assist with multiline strings, though delimiters can be placed on lines by themselves and leading and trailing newlines stripped via
3133: 2130:(though, a Python raw string cannot end in an odd number of backslashes). Python 2 also distinguishes two types of strings: 8-bit ASCII ("bytes") strings (the default), explicitly indicated with a 1546:
A few languages provide a method of specifying that a literal is to be processed without any language-specific interpretation. This avoids the need for escaping, and yields more legible strings.
1700:
and retain the syntax, despite being strings and not involving redirection. As with other string literals, these can sometimes have different behavior specified, such as variable interpolation.
1762:
operator (this is also possible in D and Python, but illegal in C/C++ โ€“ see below); in this case concatenation may happen at compile time, via constant folding, or may be deferred to run time.
1672:
is not a string literal, but instead a stream literal or file literal. These originate in shell scripts and allow a literal to be fed as input to an external command. The opening delimiter is
1661:
indented differently from the rest. Further, the literal must be unindented, as leading whitespace is preserved โ€“ this breaks the flow of the code if the literal occurs within indented code.
1989:
of integers (by the preprocessor) to define a macro that expands to a sequence of string literals, which are then concatenated to a single string literal with the file name and line number:
2088:
A subtler issue is that in C and C++, there are different types of string literals, and concatenation of these has implementation-defined behavior, which poses a potential security risk.
2526:
Nevertheless, some languages are particularly well-adapted to produce this sort of self-similar output, especially those that support multiple options for avoiding delimiter collision.
3088:: "This feature can be used to reduce the number of backslashes needed, to split long strings conveniently across long lines, or even to add comments to parts of strings, for example: 1696:
though leading spaces are not stripped. The same syntax has since been adopted for multiline string literals in a number of languages, most notably Perl, and are also referred to as
1139:
These constructor functions can also be used to represent nonprinting characters, though escape sequences are generally used instead. A similar technique can be used in C++ with the
2107:
One of the oldest examples is in shell scripts, where single quotes indicate a raw string or "literal string", while double quotes have escape sequences and variable interpolation.
2888:: "Multiple adjacent string literals (delimited by whitespace), possibly using different quoting conventions, are allowed, and their meaning is the same as their concatenation." 1692:
from the literal. Due to the delimiter being arbitrary, these also avoid the problem of delimiter collision. These also allow initial tabs to be stripped via the variant syntax
881:, there are different delimiters that are treated differently, such as doing string interpolation or not, and thus care must be taken when choosing which delimiter to use; see 172:
for compound statements, since blocks of code is in Tcl syntactically the same thing as string literals โ€“ that the delimiters are paired is essential for making this feasible.
42:
for a string value in the source code of a computer program. Modern programming languages commonly use a quoted sequence of characters, formally "bracketed delimiters", as in
2919:: "Note that this feature is defined at the syntactical level, but implemented at compile time. The โ€˜+โ€™ operator must be used to concatenate string expressions at run time." 551:
as the middle quoted portion is instead interpreted as outside of quotes. There are various solutions, the most general-purpose of which is using escape sequences, such as
1417:
32-bit Unicode character where ######## are eight hex digits (Unicode character space is currently only 21 bits wide, so the first two hex digits will always be zero)
1234:
digits, then this sequence is interpreted as representing the arbitrary code unit with the specified value in the literal's encoding (for example, the corresponding
668:. Typically, this consists of allowing the programmer to use either single quotations or double quotations interchangeably โ€“ each literal must use one or the other. 330:
Perl treats non-reserved sequences of alphanumeric characters as string literals in most contexts. For example, the following two lines of Perl are equivalent:
1439:
8-bit character specification where # is a hex digit. The length of a hex escape sequence is not limited to two digits, instead being of an arbitrary length.
1158:
history. They are accordingly widely used in string literals, and adding an escape sequence (either to a single character or throughout a string) is known as
3137: 1549:
Raw strings are particularly useful when a common character needs to be escaped, notably in regular expressions (nested as string literals), where backslash
266:
Some programming languages, such as Perl and PHP, allow string literals without any delimiters in some contexts. In the following Perl program, for example,
2404:
in the variable assignment statement) is interpreted to indicate variable interpolation, and requires some escaping if it needs to be outputted literally.
185:
These, however, are rarely used, as many programming languages will not register them (one exception is the paired double quotations which can be used in
2183:
raw strings, unicode strings (UTF-8, UTF-16, and UTF-32), and wide character strings, determined by prefixes. It also adds literals for the existing C++
1586:, due to needing to escape the string and the regular expression. Using raw strings reduces this to 4 (escaping in the regular expression), as in C# 935:
Lua (as of 5.1) provides a limited form of multiple quoting, particularly to allow nesting of long comments or embedded strings. Normally one uses
1774:
To allow long strings to span multiple lines with proper indentation in contrast to line continuation, which destroys the indentation scheme; and
1703:
Python, whose usual string literals do not allow literal newlines, instead has a special form of string, designed for multiline literals, called
1657:
Languages that allow literal newlines include bash, Lua, Perl, PHP, R, and Tcl. In some other languages string literals cannot include newlines.
1165:
One character is chosen as a prefix to give encodings for characters that are difficult or impossible to include directly. Most commonly this is
1617:
In many languages, string literals can contain literal newlines, spanning several lines. Alternatively, newlines can be escaped, most often as
1522:
Incorrect quoting of nested strings can present a security vulnerability. Use of untrusted data, as in data fields of an SQL query, should use
681:
This does not allow having a single literal with both delimiters in it, however. This can be worked around by using several literals and using
2749: 2323:. Languages that support interpolation generally distinguish strings literals that are interpolated from ones that are not. For example, in 3123:, 2.14.5 String literals , note 13, p. 28โ€“29: "Any other concatenations are conditionally supported with implementation-defined behavior." 2995: 2960: 3231: 1510:
Note: Not all sequences in the list are supported by all parsers, and there may be other escape sequences which are not in the list.
566:
but do not otherwise solve the problem of delimiter collision, since an unbalanced closing delimiter cannot simply be included, as in
2588:
instead of a specific character, what code point (if any) it represents depends on the encoding of the string literal it is found in.
3003: 2968: 547:
as the second quote is interpreted as the end of the string literal, not as the value of the string, and similarly one cannot write
2197:. These include both a usual syntax (fixed delimiters) and a generic syntax, which allows a choice of delimiters; these include: 2157: 1538:
which automatically escaped strings (for convenience and security), but due to problems was removed from version 5.4 onward.
39: 2335:
has no escaping or interpolation, a normal string (no prefix) has escaping but no interpolation, and a string prefixed with
2096:
Some languages provide more than one kind of literal, which have different behavior. This is particularly used to indicate
3027: 2664: 2111: 657: 579: 3085: 3039: 2916: 2885: 377:, where a decimal count of the number of characters was followed by the letter H, and then the characters of the string: 2773: 2553: 2401: 708: 921: 536:
When using quoting, if one wishes to represent the delimiter itself in a string literal, one runs into the problem of
772:
the programmer can enter up to 16 characters except whitespace characters, parentheses, or backslash, which form the
1020:
did not include escape sequences or any other workarounds listed here, and thus one instead was required to use the
920:
all produce the desired result. Although this notation is more flexible, few languages support it; other than Perl,
2636: 1558: 2474:
Here the $ characters are not metacharacters, and are not interpreted to have any meaning other than plain text.
543:
For example, if the delimiter is a double quote, one cannot simply represent a double quote itself by the literal
2795: 2311:
In some languages, string literals may contain placeholders referring to variables or expressions in the current
2170:
While this disables escaping, it allows double-up quotes, which allow one to represent quotes within the string:
1575: 2519: 2312: 1599: 802: 599: 587: 169: 3134:"STR10-C. Do not concatenate different type of string literals - Secure Coding - CERT Secure Coding Standards" 1218:
literal, if the backslash is followed by a letter such as "b", "n" or "t", then this represents a nonprinting
406:
quoting, because it does not require the use of balanced "bracketed" characters on either side of the string.
2518:
representation of a document for printing purposes, from within a document-processing application written in
1169:; in addition to other characters, a key point is that backslash itself can be encoded as a double backslash 1028:
the quotation mark has the value 34, so to represent a string with quotes on an ASCII system one would write
3159: 2190:
In Tcl, brace-delimited strings are literal, while quote-delimited strings have escaping and interpolation.
1380: 179:
character set includes paired (separate opening and closing) versions of both single and double quotations:
416: 145: 2853:, "String Literals": "Adjacent strings are concatenated with the ~ operator, or by simple juxtaposition:" 1770:
In C, where the concept and term originate, string literal concatenation was introduced for two reasons:
972:
that contain usual delimiters such as quotes, as this avoids needing to escape them. An early example is
828:; an unpaired non-identifier delimiter is its own closing delimiter. The paired delimiters nest, so that 1897:, to allow strings to be computed following preprocessing, particularly in macros. As a simple example: 454:
This is however not a drawback when the prefix is generated by an algorithm as is most likely the case.
711:, so consecutive string literals are concatenated even without an operator, so this can be reduced to: 2903: 2270:
uses suffix characters to specify characters or strings using their hexadecimal or binary code. E.g.,
1084:"character" format specifier, though in the presence of other workarounds this is generally not used: 3226: 3184: 2446: 2320: 2306: 1747: 682: 218: 3115: 2827: 897:, which allows the author to choose which characters should specify the bounds of a string literal. 2742: 2193:
Perl has a wide variety of strings, which are more formally considered operators, and are known as
1979: 538: 531: 422: 3060: 479:
usually allocates memory dynamically, and must copy the C-style string literal to it at run time.
415:
eliminates text searching (for the delimiter character) and therefore requires significantly less
2714: 2010: 1523: 969: 371: 114: 2929: 664:
allow more than one quoting delimiter; in the case of two possible delimiters, this is known as
127:. In practice this is often complicated by escaping, other delimiters, and excluding newlines. 2999: 2964: 2543: 2491: 1215: 1177:
for ". A regular expression for such escaped strings can be given as follows, as found in the
510:
all of which have the same interpretation. Since C++11, there is also new constructor syntax:
186: 2799: 1755: 1743: 1554: 1376: 1196: 1024:
function, which returns a string containing the character corresponding to its argument. In
2802:, 5.1.1.2 Translation phases, p. 11: "6. Adjacent string literal tokens are concatenated." 2290: 2101: 2006: 1879: 1388: 1152: 2930:"Strings (The Javaโ„ข Tutorials > Learning the Java Language > Numbers and Strings)" 1582:, and thus an escaped regular expression matching a UNC name begins with 8 backslashes, 1557:, where backslash is used as a path separator. The profusion of backslashes is known as 1894: 1527: 1284: 76: 3211: 1986: 110:
technology which was the precursor of the earliest computer input and output devices.
3220: 2531: 2397: 1669: 1665: 1207: 929: 428: 106:(the same character is used as an opener and a closer), which is a hangover from the 3101:- Warn against and then deprecate implicit concatenation of adjacent string literals 2608: 1561:, and can be reduced by using raw strings. Compare escaped and raw pathnames in C#: 490:
at the end of the literal), so the normal constructor syntax was used, for example:
2548: 2497: 2324: 1535: 874: 86: 3011: 2146:
prefix. while in Python 3 strings are Unicode by default and bytes are a separate
1746:(as a phase following initial tokenization), and is contrasted with both run time 1173:
and for delimited strings the delimiter itself can be encoded by escaping, say by
610:
on the quotation marks that are intended to be part of the string literal itself:
168:; this derives from the single quotations in Unix shells and the use of braces in 160:
allows both quotes (for interpolated strings) and braces (for raw strings), as in
1890:(C++), which cannot be added; this is not a restriction in most other languages. 125:
a quote, followed by zero, one, or more non-quote characters, followed by a quote
3098: 2976: 1778: 1239: 842:
Similar to C++11, D allows here-document-style literals with end-of-string ids:
809:
plus an opening delimiter and ending with the respective closing delimiter and
2515: 653: 445: 370:
programming language (for example), string literals were written in so-called
153: 137: 107: 89:
is literally written by a pair of quotes with no character at all in between:
17: 2989: 2954: 2585: 2005:
Beyond syntactic requirements of C/C++, implicit concatenation is a form of
1716: 1166: 783:
The simplest case of such a literal is with empty content and empty eos id:
591: 403: 201: 68: 2572:
The regex given here is not itself quoted or escaped, to reduce confusion.
2811: 1428:
21-bit Unicode character where ###### is a variable number of hex digits
1238:
code for an ASCII literal). This was later extended to allow more modern
1188:
itself be escaped. Multiple characters can follow the backslash, such as
649: 149: 3110: 2822: 2530:
to subvert the operation of the application, for example by mounting an
2180: 1715:. These literals are especially used for inline documentation, known as 925: 732: 1403: 1076: 645: 603: 367: 176: 434:
can be used for quite effective data compression of plain text strings
2409: 1178: 2315:, which are evaluated (usually at run time). This is referred to as 781:
string โ€“ a closing parenthesis, the eos id, and a quote is required.
562:
Paired quotes, such as braces in Tcl, allow nested strings, such as
805:
supports a few quoting delimiters, with such strings starting with
2743:"Rationale for International Standard - Programming Languages - C" 1689: 1594: 1384: 1235: 1231: 1025: 1017: 583: 217:, string literals may be specified by the relative positioning of 2413:
function, which produces the same output using notation such as:
1893:
This is particularly important when used in combination with the
482:
Before C++11, there was no literal for C++ strings (C++11 allows
462:
C++ has two styles of string, one inherited from C (delimited by
2504: 2347: 2267: 2187:, which is generally preferred to the existing C-style strings. 928:
also support these. A variant of multiple quoting is the use of
901: 878: 776:(its purpose is to be repeated to signal the end of the string, 444:
this type of notation is error-prone if used as manual entry by
214: 2863: 2150:
type that when initialized with quotes must be prefixed with a
1230:
character respectively. Or if the backslash is followed by 1-3
2508: 1531: 973: 661: 595: 157: 402:
This declarative notation style is contrasted with bracketed
3061:"LINE__ to string (stringify) using preprocessor directives" 2104:, such as to indicate hexadecimal numbers or long integers. 1777:
To allow the construction of string literals by macros (via
634:"I said, ""Can you hear me?""" 2382:"$ name said $ greeting to the crowd of people." 2904:
Implicit string literal concatenation considered harmful?
2175:@"I said, ""Hello there.""" 1684:
on a line by itself, serving as a content boundary โ€“ the
1471:
non-character used to delimit numeric escapes in Haskell
2460:'$ name said $ greeting to the crowd of people.' 1450:
8-bit character specification where o is an octal digit
505:
std::string str = string("explicit constructor syntax");
2850: 2449:, but the variables themselves are outside the string. 992:
delimiters can be replaced by another character, as in
3160:"2. Lexical analysis โ€” Python 2.7.12rc1 documentation" 3116:"Working Draft, Standard for Programming Language C++" 3040:"python - Why allow concatenation of string literals?" 2828:"Working Draft, Standard for Programming Language C++" 450:
special care is needed in case of multi byte encodings
210:
There might be special syntax for multi-line strings.
2637:"Appendix B. Characters, strings, and escaping rules" 1978:
A common use case is in constructing printf or scanf
1343:
carriage return (or newline in Mac OS 9 and earlier)
1288:(typically as a special case of \ooo octal notation) 3084:
The Python Language Reference, 2. Lexical analysis,
2915:
The Python Language Reference, 2. Lexical analysis,
2884:
The Python Language Reference, 2. Lexical analysis,
2845: 2000:#define AT __FILE__ ":" TOSTRING(__LINE__) 832:
is a valid literal; an example with the non-nesting
799:
Escape sequences don't work in raw string literals.
2898: 2896: 2894: 1566:"The Windows path is C:\\Foo\\Bar\\Baz\\" 182:โ€œHi There!โ€ โ€˜Hi There!โ€™ โ€žHi There!โ€œ ยซHi There!ยป 2737: 2735: 2584:Since this escape sequence represents a specific 2160:'s notation for raw strings is called @-quoting. 1953:which is then concatenated, being equivalent to: 1574:Extreme examples occur when these are combined โ€“ 870:must be an identifier (alphanumeric characters). 500:std::string str("converting constructor syntax"); 27:Notation for representing a string in source code 1569:@"The Windows path is C:\Foo\Bar\Baz\" 123:This means that a string literal is written as: 2748:. 5.10. April 2003. pp. 52, 153โ€“154, 159. 2471:$ name said $ greeting to the crowd of people. 2393:Nancy said Hello World to the crowd of people. 1982:, where format specifiers are given by macros. 1664:The most common solution for these problems is 882: 2421:"%s said %s to the crowd of people." 2138:prefix, and Unicode strings, indicated with a 1680:can be any word, and the closing delimiter is 676:'I said, "Can you hear me?"' 515:std::string str{"uniform initializer syntax"}; 2991:Rationale for the ANSI C Programming Language 2956:Rationale for the ANSI C Programming Language 2774:"6.35 The Character <ESC> in Constants" 1668:-style string literals. Formally speaking, a 968:Multiple quoting is particularly useful with 957:This notation can be used for Windows paths: 557:"This is \"in quotes\" and properly escaped." 117:, a basic quoted string literal is given as: 79:are the most common quoting delimiters used: 8: 2659: 2657: 2496:generating an output language from within a 2400:character ($ ) (not to be confused with the 1925:will (if the file is called a.c) expand to: 431:that might otherwise be mistaken as commands 197:String literals might be ended by newlines. 2800:WG14 N1570 Committee Draft โ€” April 12, 2011 2580: 2578: 1534:2 through 5.3, there was a feature called 1074:In C, a similar facility is available via 2631: 2629: 1406:character where #### are four hex digits 253:appear here. The extent of this string is 2478:Embedding source code in string literals 2441:but does not perform interpolation: the 1707:. These use a tripled delimiter, either 1263: 915:qqยงI said, "Can you hear me?"ยง 912:qq@I said, "Can you hear me?"@ 909:qq^I said, "Can you hear me?"^ 207:{{Navbox |name=Nulls |title=] in ] }} 2868:, Ruby Programming Language, 2017-10-19 2709: 2707: 2705: 2600: 2565: 2452:This is contrasted with "raw" strings: 873:In some programming languages, such as 520:auto str = "constexpr literal syntax"s; 495:std::string str = "initializer syntax"; 278:are string literals, but are unquoted: 152:(`) as the starting delimiter, and the 2812:C syntax: String literal concatenation 2703: 2701: 2699: 2697: 2695: 2693: 2691: 2689: 2687: 2685: 1273:Literal Characters placed into string 1195:An escaped string must then itself be 789:The eos id may itself contain quotes: 559:, but there are many other solutions. 250:"special" metacharacters may 67:Most modern programming languages use 1878:This is because string literals have 673:"This is John's apple." 7: 1829:However, the following are invalid: 1192:, depending on the escaping scheme. 976:, where in the substitution command 830:q"(A pair "()" of parens in quotes)" 235:An example multi-line string in YAML 3086:2.4.2. String literal concatenation 2917:2.4.2. String literal concatenation 2886:2.4.2. String literal concatenation 2865:ruby: The Ruby Programming Language 2407:This should be contrasted with the 1754:operator) and concatenation during 1553:is widely used, and in DOS/Windows 549:"This is "in quotes", but invalid." 1730:can be used to strip indentation. 1206:Many languages support the use of 1119:"This is %cin quotes.%c" 893:A further extension is the use of 793:is a valid literal (the eos id is 791:R""(I asked, "Can you hear me?")"" 25: 2906:", Guido van Rossum, May 10, 2013 2114:, raw strings are preceded by an 578:A number of languages, including 470:in the C++ Standard Library. The 3097:DLang's Issue Tracking System โ€“ 2343:has escaping and interpolation. 2097: 1997:#define TOSTRING(x) STRINGIFY(x) 1651:are both valid bash, producing: 1332:line feed (or newline in POSIX) 838:q"/I asked, "Can you hear me?"/" 813:. Available delimiter pairs are 716:'I said, "This is ' 690:'I said, "This is ' 140:, which uses parentheses, as in 2994:. Silicon Press. 1990. p.  2959:. Silicon Press. 1990. p.  2755:from the original on 2016-06-06 739:. They consist, essentially of 606:, avoid delimiter collision by 50:is a string literal with value 2195:quote and quote-like operators 75:) to specify string literals. 1: 2293:, avoiding the function call 2039:# letter, digit or underscore 156:(') as the ending delimiter. 2554:Sigil (computer programming) 2165:@"C:\Foo\Bar\Baz\" 1985:A more complex example uses 1740:string literal concatenation 1734:String literal concatenation 1054:"Can you hear me?" 1016:For example, early forms of 709:string literal concatenation 247:This is a multi-line string. 3185:"perlop - perldoc.perl.org" 2468:which produce output like: 2346:For example, the following 256:represented by indentation. 3248: 2304: 2092:Different kinds of strings 1559:leaning toothpick syndrome 1150: 1143:stringification operator. 883:different kinds of strings 529: 102:These quotation marks are 3232:String (computer science) 2325:sh-compatible Unix shells 1613:Multiline string literals 1576:Uniform Naming Convention 1242:character code notation: 924:(influenced by Perl) and 427:enables the inclusion of 2490:writing code to produce 2454: 2415: 2352: 2272: 2199: 2172: 2162: 2055: 2015: 1991: 1970:"a.c: message" 1955: 1927: 1899: 1831: 1788: 1738:A few languages provide 1639: 1623: 1604: 1563: 1244: 1086: 1030: 942: 906: 713: 687: 670: 644:Some languages, such as 631: 621:contains two apostrophes 612: 379: 332: 280: 223: 3212:Literals In Programming 2522:or some other language. 2373:"Hello World" 1994:#define STRINGIFY(x) #x 722:' apple."' 702:' apple."' 615:'This Pascal string 484:"this is a C++ string"s 166:{The quick {brown fox}} 142:(The quick (brown fox)) 3012:3.8.3.2 The # operator 2846:D Programming Language 2715:"Escape Sequences (C)" 2609:"ANSI C grammar (Lex)" 2445:is a placeholder in a 2317:variable interpolation 2033:# letter or underscore 1688:is due to redirecting 719:"John's" 696:"John's" 421:avoids the problem of 2977:3.1.4 String literals 2507:to generate XSLT, or 2390:produces the output: 2279:"0010 0000" 1945:": message" 1917:": message" 1008:Constructor functions 735:introduced so-called 458:Constructor functions 204:template parameters. 193:Whitespace delimiters 162:"The quick brown fox" 3024:C/C++ Users Journal, 2641:realworldhaskell.org 2511:to generate more SQL 2447:printf format string 2321:string interpolation 2319:, or more generally 2307:String interpolation 2301:String interpolation 2283:"00100000" 1750:(generally with the 1748:string concatenation 1646:"foo\nbar" 1033:"I said, " 683:string concatenation 362:Declarative notation 63:Bracketed delimiters 1864:"hello, " 1846:"hello, " 1818:"hello, " 1803:"hello, " 1524:prepared statements 1447:Depends on encoding 1436:Depends on encoding 1214:For instance, in a 970:regular expressions 737:raw string literals 539:delimiter collision 532:Delimiter collision 526:Delimiter collision 423:delimiter collision 115:regular expressions 73:balanced delimiters 2396:In this case, the 2011:regular expression 1593:In XML documents, 1504:question mark (?) 1197:lexically analyzed 988:the default slash 69:bracket delimiters 2544:Character literal 2361:"Nancy" 1870:"world" 1852:"world" 1821:"world" 1806:"world" 1578:paths begin with 1508: 1507: 1482:single quote (') 1461:double quote (") 728:Delimiter quoting 466:), and the safer 221:and indentation. 187:Visual Basic .NET 148:, which uses the 131:Paired delimiters 77:Double quotations 16:(Redirected from 3239: 3200: 3199: 3197: 3195: 3181: 3175: 3174: 3172: 3170: 3156: 3150: 3149: 3147: 3145: 3140:on July 14, 2014 3136:. Archived from 3130: 3124: 3122: 3120: 3113:draft standard, 3108: 3102: 3095: 3089: 3082: 3076: 3075: 3073: 3072: 3057: 3051: 3050: 3048: 3047: 3042:. Stack Overflow 3036: 3030: 3021: 3015: 3009: 2986: 2980: 2974: 2951: 2945: 2944: 2942: 2941: 2926: 2920: 2913: 2907: 2900: 2889: 2882: 2876: 2875: 2874: 2873: 2860: 2854: 2851:Lexical Analysis 2842: 2836: 2834: 2832: 2825:draft standard, 2820: 2814: 2809: 2803: 2798:draft standard, 2793: 2787: 2786: 2785: 2784: 2778:GCC 4.8.2 Manual 2770: 2764: 2763: 2761: 2760: 2754: 2747: 2739: 2730: 2729: 2727: 2725: 2711: 2680: 2679: 2677: 2675: 2661: 2652: 2651: 2649: 2647: 2633: 2624: 2623: 2621: 2619: 2605: 2589: 2582: 2573: 2570: 2464: 2461: 2458: 2444: 2437: 2434: 2431: 2428: 2425: 2422: 2419: 2412: 2386: 2383: 2380: 2377: 2374: 2371: 2368: 2365: 2362: 2359: 2356: 2342: 2338: 2334: 2330: 2296: 2284: 2280: 2276: 2263: 2260: 2257: 2254: 2251: 2248: 2245: 2242: 2239: 2236: 2233: 2230: 2227: 2224: 2221: 2218: 2215: 2212: 2209: 2206: 2203: 2186: 2176: 2166: 2153: 2149: 2145: 2141: 2137: 2133: 2129: 2125: 2121: 2117: 2110:For example, in 2102:integer literals 2080: 2077: 2074: 2071: 2068: 2065: 2062: 2059: 2043: 2040: 2037: 2034: 2031: 2028: 2025: 2022: 2019: 2001: 1998: 1995: 1974: 1971: 1968: 1965: 1964:file_and_message 1962: 1959: 1949: 1946: 1943: 1940: 1937: 1936:file_and_message 1934: 1931: 1921: 1918: 1915: 1912: 1909: 1908:file_and_message 1906: 1903: 1889: 1885: 1874: 1871: 1868: 1865: 1862: 1859: 1856: 1853: 1850: 1847: 1844: 1841: 1838: 1835: 1825: 1822: 1819: 1816: 1813: 1810: 1807: 1804: 1801: 1798: 1795: 1792: 1761: 1756:constant folding 1753: 1744:lexical analysis 1729: 1725: 1714: 1710: 1695: 1687: 1683: 1679: 1675: 1647: 1643: 1633: 1630: 1627: 1620: 1608: 1589: 1585: 1581: 1570: 1567: 1552: 1377:escape character 1264: 1260: 1257: 1254: 1251: 1248: 1191: 1176: 1172: 1147:Escape sequences 1142: 1135: 1132: 1129: 1126: 1123: 1120: 1117: 1114: 1111: 1108: 1105: 1102: 1099: 1096: 1093: 1090: 1083: 1079: 1070: 1067: 1064: 1061: 1058: 1055: 1052: 1049: 1046: 1043: 1040: 1037: 1034: 1023: 1003: 991: 987: 964: 961: 958: 955: 952: 949: 946: 938: 932:-style strings. 916: 913: 910: 900:For example, in 895:multiple quoting 889:Multiple quoting 868:end-of-string-id 862: 858:end-of-string-id 850:end-of-string-id 848: 839: 835: 831: 827: 824: 820: 816: 812: 808: 796: 792: 786: 774:end-of-string-id 771: 763: 759:end-of-string-id 757: 751: 747:end-of-string-id 745: 723: 720: 717: 703: 700: 697: 694: 691: 677: 674: 635: 628: 625: 622: 619: 616: 569: 565: 564:{foo {bar} zork} 558: 554: 550: 546: 521: 516: 506: 501: 496: 489: 485: 478: 473: 469: 465: 398: 395: 392: 389: 386: 383: 366:In the original 357: 354: 351: 348: 345: 342: 339: 336: 326: 323: 320: 317: 314: 311: 308: 305: 302: 299: 296: 293: 290: 287: 284: 277: 273: 269: 257: 254: 251: 248: 245: 242: 239: 236: 233: 230: 227: 167: 163: 143: 53: 49: 45: 36:anonymous string 21: 3247: 3246: 3242: 3241: 3240: 3238: 3237: 3236: 3217: 3216: 3208: 3203: 3193: 3191: 3183: 3182: 3178: 3168: 3166: 3158: 3157: 3153: 3143: 3141: 3132: 3131: 3127: 3118: 3114: 3109: 3105: 3096: 3092: 3083: 3079: 3070: 3068: 3059: 3058: 3054: 3045: 3043: 3038: 3037: 3033: 3022: 3018: 3006: 2988: 2987: 2983: 2971: 2953: 2952: 2948: 2939: 2937: 2934:Docs.oracle.com 2928: 2927: 2923: 2914: 2910: 2902:Python-ideas, " 2901: 2892: 2883: 2879: 2871: 2869: 2862: 2861: 2857: 2843: 2839: 2830: 2826: 2821: 2817: 2810: 2806: 2794: 2790: 2782: 2780: 2772: 2771: 2767: 2758: 2756: 2752: 2745: 2741: 2740: 2733: 2723: 2721: 2713: 2712: 2683: 2673: 2671: 2663: 2662: 2655: 2645: 2643: 2635: 2634: 2627: 2617: 2615: 2607: 2606: 2602: 2598: 2593: 2592: 2583: 2576: 2571: 2567: 2562: 2540: 2480: 2472: 2466: 2465: 2462: 2459: 2456: 2442: 2439: 2438: 2435: 2432: 2429: 2426: 2423: 2420: 2417: 2408: 2394: 2388: 2387: 2384: 2381: 2378: 2375: 2372: 2369: 2366: 2363: 2360: 2357: 2354: 2340: 2336: 2332: 2328: 2309: 2303: 2294: 2291:space character 2287: 2286: 2282: 2278: 2274: 2265: 2264: 2261: 2258: 2255: 2252: 2249: 2246: 2243: 2240: 2237: 2234: 2231: 2228: 2225: 2222: 2219: 2216: 2213: 2210: 2207: 2204: 2201: 2184: 2178: 2177: 2174: 2168: 2167: 2164: 2151: 2147: 2143: 2139: 2135: 2131: 2127: 2123: 2119: 2115: 2094: 2082: 2081: 2078: 2075: 2072: 2069: 2066: 2063: 2060: 2057: 2050: 2045: 2044: 2041: 2038: 2035: 2032: 2029: 2026: 2023: 2020: 2017: 2007:syntactic sugar 2003: 2002: 1999: 1996: 1993: 1987:stringification 1976: 1975: 1972: 1969: 1966: 1963: 1960: 1957: 1951: 1950: 1947: 1944: 1942:"a.c" 1941: 1938: 1935: 1932: 1929: 1923: 1922: 1919: 1916: 1913: 1910: 1907: 1904: 1901: 1887: 1883: 1876: 1875: 1872: 1869: 1866: 1863: 1860: 1857: 1854: 1851: 1848: 1845: 1842: 1839: 1836: 1833: 1827: 1826: 1823: 1820: 1817: 1814: 1811: 1808: 1805: 1802: 1799: 1796: 1793: 1790: 1768: 1759: 1751: 1736: 1727: 1723: 1712: 1708: 1698:here documents, 1693: 1685: 1681: 1677: 1673: 1655: 1649: 1648: 1645: 1641: 1635: 1634: 1631: 1628: 1625: 1621:. For example: 1618: 1615: 1610: 1609: 1606: 1587: 1583: 1579: 1572: 1571: 1568: 1565: 1550: 1544: 1516: 1514:Nested escaping 1354:horizontal tab 1287: 1267:Escape Sequence 1262: 1261: 1258: 1255: 1252: 1249: 1246: 1189: 1185: 1181:specification: 1174: 1170: 1155: 1153:Escape sequence 1149: 1140: 1137: 1136: 1133: 1130: 1127: 1124: 1121: 1118: 1115: 1112: 1109: 1106: 1103: 1100: 1097: 1094: 1091: 1088: 1081: 1075: 1072: 1071: 1068: 1065: 1062: 1059: 1056: 1053: 1050: 1047: 1044: 1041: 1038: 1035: 1032: 1021: 1010: 993: 989: 977: 966: 965: 962: 959: 956: 953: 950: 947: 944: 936: 918: 917: 914: 911: 908: 891: 860: 846: 841: 837: 833: 829: 826: 822: 818: 814: 810: 806: 798: 794: 790: 788: 784: 782: 769: 768:that is, after 761: 755: 749: 743: 730: 725: 724: 721: 718: 715: 705: 704: 701: 698: 695: 692: 689: 679: 678: 675: 672: 642: 637: 636: 633: 630: 629: 626: 623: 620: 617: 614: 576: 567: 563: 556: 552: 548: 544: 534: 528: 519: 514: 504: 499: 494: 487: 483: 476: 471: 467: 463: 460: 400: 399: 396: 393: 390: 387: 384: 381: 364: 359: 358: 355: 352: 349: 346: 343: 340: 337: 334: 328: 327: 324: 321: 318: 315: 312: 309: 306: 303: 300: 297: 294: 291: 288: 285: 282: 275: 271: 267: 264: 259: 258: 255: 252: 249: 246: 243: 240: 237: 234: 231: 228: 225: 208: 200:One example is 195: 183: 165: 161: 141: 133: 121: 100: 93: 83: 65: 60: 51: 47: 43: 28: 23: 22: 15: 12: 11: 5: 3245: 3243: 3235: 3234: 3229: 3219: 3218: 3215: 3214: 3207: 3206:External links 3204: 3202: 3201: 3176: 3151: 3125: 3103: 3090: 3077: 3052: 3031: 3016: 3004: 2981: 2969: 2946: 2921: 2908: 2890: 2877: 2855: 2837: 2815: 2804: 2788: 2765: 2731: 2681: 2653: 2625: 2599: 2597: 2594: 2591: 2590: 2574: 2564: 2563: 2561: 2558: 2557: 2556: 2551: 2546: 2539: 2536: 2524: 2523: 2512: 2501: 2494: 2479: 2476: 2470: 2455: 2416: 2392: 2353: 2305:Main article: 2302: 2299: 2289:all yield the 2273: 2200: 2173: 2163: 2093: 2090: 2076:'zork' 2056: 2049: 2046: 2016: 1992: 1980:format strings 1956: 1928: 1900: 1895:C preprocessor 1832: 1789: 1783: 1782: 1775: 1767: 1764: 1735: 1732: 1705:triple quoting 1653: 1640: 1624: 1614: 1611: 1605: 1564: 1543: 1540: 1528:code injection 1515: 1512: 1506: 1505: 1502: 1499: 1495: 1494: 1493:backslash (\) 1491: 1488: 1484: 1483: 1480: 1477: 1473: 1472: 1469: 1467: 1463: 1462: 1459: 1456: 1452: 1451: 1448: 1445: 1441: 1440: 1437: 1434: 1430: 1429: 1426: 1423: 1419: 1418: 1415: 1412: 1408: 1407: 1400: 1397: 1393: 1392: 1374: 1371: 1367: 1366: 1363: 1360: 1356: 1355: 1352: 1349: 1345: 1344: 1341: 1338: 1334: 1333: 1330: 1327: 1323: 1322: 1319: 1316: 1312: 1311: 1308: 1305: 1301: 1300: 1297: 1294: 1290: 1289: 1285:null character 1282: 1279: 1275: 1274: 1271: 1268: 1253:n you hear me? 1245: 1208:metacharacters 1183: 1151:Main article: 1148: 1145: 1087: 1031: 1009: 1006: 960:local path = ] 943: 907: 890: 887: 864: 863: 766: 765: 729: 726: 714: 688: 671: 641: 638: 632: 613: 575: 572: 530:Main article: 527: 524: 523: 522: 517: 508: 507: 502: 497: 459: 456: 452: 451: 448: 436: 435: 432: 429:metacharacters 425: 419: 380: 363: 360: 333: 281: 263: 260: 224: 206: 194: 191: 181: 132: 129: 119: 98: 91: 81: 64: 61: 59: 56: 32:string literal 26: 24: 18:Literal string 14: 13: 10: 9: 6: 4: 3: 2: 3244: 3233: 3230: 3228: 3225: 3224: 3222: 3213: 3210: 3209: 3205: 3190: 3186: 3180: 3177: 3165: 3161: 3155: 3152: 3139: 3135: 3129: 3126: 3117: 3112: 3107: 3104: 3100: 3094: 3091: 3087: 3081: 3078: 3066: 3065:Decompile.com 3062: 3056: 3053: 3041: 3035: 3032: 3029: 3025: 3020: 3017: 3013: 3007: 3005:0-929306-07-4 3001: 2997: 2993: 2992: 2985: 2982: 2978: 2972: 2970:0-929306-07-4 2966: 2962: 2958: 2957: 2950: 2947: 2935: 2931: 2925: 2922: 2918: 2912: 2909: 2905: 2899: 2897: 2895: 2891: 2887: 2881: 2878: 2867: 2866: 2859: 2856: 2852: 2849: 2847: 2841: 2838: 2829: 2824: 2819: 2816: 2813: 2808: 2805: 2801: 2797: 2792: 2789: 2779: 2775: 2769: 2766: 2751: 2744: 2738: 2736: 2732: 2720: 2719:microsoft.com 2716: 2710: 2708: 2706: 2704: 2702: 2700: 2698: 2696: 2694: 2692: 2690: 2688: 2686: 2682: 2670: 2666: 2660: 2658: 2654: 2642: 2638: 2632: 2630: 2626: 2614: 2610: 2604: 2601: 2595: 2587: 2581: 2579: 2575: 2569: 2566: 2559: 2555: 2552: 2550: 2547: 2545: 2542: 2541: 2537: 2535: 2533: 2532:SQL injection 2527: 2521: 2517: 2514:generating a 2513: 2510: 2506: 2502: 2499: 2495: 2493: 2489: 2488: 2487: 2486:For example: 2484: 2477: 2475: 2469: 2453: 2450: 2448: 2414: 2411: 2405: 2403: 2399: 2398:metacharacter 2391: 2351: 2349: 2344: 2326: 2322: 2318: 2314: 2308: 2300: 2298: 2292: 2271: 2269: 2198: 2196: 2191: 2188: 2182: 2171: 2161: 2159: 2155: 2128:r'C:\Windows' 2124:'C:\\Windows' 2113: 2108: 2105: 2103: 2099: 2091: 2089: 2086: 2073:'bar' 2067:'foo' 2054: 2047: 2036:"*" 2014: 2013:in this way: 2012: 2008: 1990: 1988: 1983: 1981: 1954: 1926: 1898: 1896: 1891: 1881: 1830: 1787: 1780: 1776: 1773: 1772: 1771: 1765: 1763: 1757: 1749: 1745: 1741: 1733: 1731: 1720: 1718: 1706: 1701: 1699: 1691: 1671: 1670:here document 1667: 1666:here document 1662: 1658: 1652: 1638: 1622: 1612: 1603: 1601: 1596: 1591: 1577: 1562: 1560: 1556: 1547: 1541: 1539: 1537: 1533: 1529: 1526:to prevent a 1525: 1520: 1513: 1511: 1503: 1500: 1497: 1496: 1492: 1489: 1486: 1485: 1481: 1478: 1475: 1474: 1470: 1468: 1465: 1464: 1460: 1457: 1454: 1453: 1449: 1446: 1443: 1442: 1438: 1435: 1432: 1431: 1427: 1424: 1421: 1420: 1416: 1413: 1410: 1409: 1405: 1401: 1398: 1395: 1394: 1390: 1386: 1382: 1378: 1375: 1372: 1369: 1368: 1365:vertical tab 1364: 1361: 1358: 1357: 1353: 1350: 1347: 1346: 1342: 1339: 1336: 1335: 1331: 1328: 1325: 1324: 1320: 1317: 1314: 1313: 1309: 1306: 1303: 1302: 1298: 1295: 1292: 1291: 1286: 1283: 1280: 1277: 1276: 1272: 1269: 1266: 1265: 1247:"I said, 1243: 1241: 1237: 1233: 1229: 1225: 1221: 1217: 1212: 1209: 1204: 1200: 1198: 1193: 1182: 1180: 1168: 1163: 1161: 1154: 1146: 1144: 1085: 1078: 1029: 1027: 1019: 1014: 1007: 1005: 1001: 997: 985: 981: 975: 971: 941: 933: 931: 930:here document 927: 923: 905: 903: 898: 896: 888: 886: 884: 880: 876: 871: 869: 859: 855: 851: 845: 844: 843: 836:character is 804: 800: 779: 775: 760: 754: 748: 742: 741: 740: 738: 734: 727: 712: 710: 686: 684: 669: 667: 663: 659: 655: 651: 647: 639: 611: 609: 605: 601: 597: 593: 589: 585: 581: 573: 571: 560: 542: 540: 533: 525: 518: 513: 512: 511: 503: 498: 493: 492: 491: 480: 457: 455: 449: 447: 443: 442: 441: 440: 433: 430: 426: 424: 420: 418: 414: 413: 412: 411: 407: 405: 378: 376: 374: 369: 361: 341:"x" 331: 279: 262:No delimiters 261: 222: 220: 216: 211: 205: 203: 198: 192: 190: 188: 180: 178: 173: 171: 159: 155: 151: 147: 139: 130: 128: 126: 118: 116: 111: 109: 105: 97: 90: 88: 80: 78: 74: 70: 62: 57: 55: 41: 37: 33: 19: 3192:. Retrieved 3188: 3179: 3167:. Retrieved 3163: 3154: 3142:. Retrieved 3138:the original 3128: 3106: 3093: 3080: 3069:. Retrieved 3067:. 2006-10-12 3064: 3055: 3044:. Retrieved 3034: 3023: 3019: 2990: 2984: 2955: 2949: 2938:. Retrieved 2936:. 2012-02-28 2933: 2924: 2911: 2880: 2870:, retrieved 2864: 2858: 2844: 2840: 2818: 2807: 2791: 2781:, retrieved 2777: 2768: 2757:. Retrieved 2722:. Retrieved 2718: 2672:. Retrieved 2668: 2644:. Retrieved 2640: 2616:. Retrieved 2612: 2603: 2568: 2549:XML Literals 2528: 2525: 2498:web template 2485: 2481: 2473: 2467: 2451: 2440: 2406: 2395: 2389: 2345: 2316: 2310: 2288: 2275:'20' 2266: 2205:"" 2194: 2192: 2189: 2181:C++11 allows 2179: 2169: 2156: 2109: 2106: 2095: 2087: 2083: 2051: 2030:"" 2004: 1984: 1977: 1952: 1924: 1892: 1877: 1828: 1784: 1769: 1739: 1737: 1721: 1704: 1702: 1697: 1694:<<-END 1663: 1659: 1656: 1650: 1636: 1616: 1592: 1573: 1548: 1545: 1536:magic quotes 1521: 1519:and author. 1517: 1509: 1227: 1223: 1219: 1213: 1205: 1201: 1194: 1186: 1164: 1159: 1156: 1138: 1073: 1015: 1011: 999: 995: 983: 979: 967: 934: 919: 899: 894: 892: 872: 867: 865: 857: 853: 849: 801: 777: 773: 767: 758: 752: 746: 736: 731: 706: 680: 666:dual quoting 665: 643: 640:Dual quoting 607: 577: 561: 537: 535: 509: 481: 461: 453: 438: 437: 409: 408: 401: 372: 365: 329: 265: 212: 209: 199: 196: 184: 174: 134: 124: 122: 113:In terms of 112: 103: 101: 99:'Hi There!' 94: 87:empty string 84: 82:"Hi There!" 72: 66: 35: 31: 29: 3227:Source code 3026:Volume 19, 2669:mozilla.org 2098:raw strings 1888:const char 1779:stringizing 1724:string trim 1674:<<END 1600:well formed 1542:Raw strings 1530:attack. In 1240:hexadecimal 1141:std::string 1000:replacement 984:replacement 707:Python has 608:doubling up 574:Doubling up 477:std::string 472:std::string 468:std::string 446:programmers 410:Advantages: 3221:Categories 3164:python.org 3099:Issue 3827 3071:2016-06-22 3046:2016-06-22 2940:2016-06-22 2872:2017-10-19 2783:2014-03-08 2759:2010-10-17 2596:References 2516:PostScript 2433:$ greeting 2367:$ greeting 2202:'' 2122:โ€“ compare 1880:array type 1766:Motivation 1728:string map 1717:docstrings 1607:<!]> 1584:"\\\\\\\\" 1422:\u{######} 1411:\U######## 1321:form feed 1310:backspace 1250:\t\t\x22Ca 866:In D, the 654:JavaScript 624:'' 618:'' 439:Drawbacks: 219:whitespace 154:apostrophe 138:PostScript 108:typewriter 46:, where , 2586:code unit 1220:backspace 1184:"(\\.|)*" 1167:backslash 885:, below. 592:Smalltalk 486:with the 404:delimiter 391:Hollerith 373:Hollerith 202:MediaWiki 44:x = "foo" 3189:perl.org 2750:Archived 2665:"String" 2538:See also 2534:attack. 2048:Problems 1914:__FILE__ 1726:, while 1686:<< 1654:foo bar 1632:bar' 1629:'foo 1425:U+###### 1414:U+###### 1216:C string 1160:escaping 1098:snprintf 1080:and the 856:newline 852:newline 819:<> 650:Modula-2 417:overhead 375:notation 150:backtick 136:include 104:unpaired 3194:22 June 3169:22 June 3144:July 3, 2724:22 June 2674:22 June 2646:22 June 2618:22 June 2313:context 2295:X2C(20) 2024:compile 1886:(C) or 1588:@"\\\\" 1404:Unicode 1402:16-bit 1270:Unicode 1224:newline 1077:sprintf 854:content 753:content 646:Fortran 604:Fortran 397:literal 388:example 368:FORTRAN 177:Unicode 40:literal 3002:  2967:  2613:liu.se 2503:using 2492:quines 2427:$ name 2418:printf 2410:printf 2355:$ name 2350:code: 2185:string 2112:Python 1858:printf 1812:printf 1676:where 1501:U+003F 1490:U+005C 1479:U+0027 1466:\& 1458:U+0022 1399:U+#### 1396:\u#### 1373:U+001B 1362:U+000B 1351:U+0009 1340:U+000D 1329:U+000A 1318:U+000C 1307:U+0008 1299:alert 1296:U+0007 1281:U+0000 1259:" 1256:\x22\n 1190:\uFFFF 1179:ANSI C 1113:buffer 1110:sizeof 1104:buffer 1092:buffer 825:, and 797:here.) 778:eos id 660:, and 658:Python 602:, and 580:Pascal 394:string 274:, and 71:(also 58:Syntax 3119:(PDF) 3111:C++11 3028:p. 50 2831:(PDF) 2823:C++11 2753:(PDF) 2746:(PDF) 2560:Notes 2457:print 2402:sigil 2379:print 2250:s{}{} 2148:bytes 2126:with 1884:char 1690:stdin 1595:CDATA 1555:paths 1385:clang 1236:ASCII 1232:octal 1060:CHR$ 1039:CHR$ 1026:ASCII 1022:CHR$ 1018:BASIC 996:regex 980:regex 945:local 926:C++11 785:R"()" 733:C++11 627:' 584:BASIC 322:0xf00 319:=> 316:green 310:0x0f0 307:=> 298:0x00f 295:=> 272:green 238:body 229:title 48:"foo" 38:is a 3196:2016 3171:2016 3146:2014 3000:ISBN 2996:6566 2965:ISBN 2726:2016 2676:2016 2648:2016 2620:2016 2505:XSLT 2348:Perl 2268:REXX 2262:{}{} 2256:{}{} 2247:qr{} 2241:qw{} 2238:qx{} 2235:qq{} 2220:s/// 2217:qr// 1958:char 1930:char 1902:char 1834:char 1791:char 1642:echo 1637:and 1626:echo 1444:\ooo 1433:\x## 1387:and 1089:char 922:Ruby 902:Perl 879:Perl 877:and 553:"\"" 304:blue 283:%map 276:blue 215:YAML 175:The 144:and 120:"*" 2796:C11 2509:SQL 2339:or 2331:or 2244:m{} 2232:q{} 2214:m// 2142:or 2134:or 2118:or 1713:""" 1711:or 1709:''' 1682:END 1678:END 1532:PHP 1389:tcc 1381:GCC 1228:tab 1226:or 974:sed 963:]=] 954:[=[ 662:PHP 596:SQL 588:DCL 568:{}} 555:or 545:""" 385:HAn 347:$ y 335:$ y 292:red 268:red 213:In 164:or 158:Tcl 92:"" 85:An 52:foo 34:or 3223:: 3187:. 3162:. 3063:. 3010:, 2998:. 2975:, 2963:. 2961:31 2932:. 2893:^ 2776:, 2734:^ 2717:. 2684:^ 2667:. 2656:^ 2639:. 2628:^ 2611:. 2577:^ 2443:%s 2297:. 2285:b 2281:b 2277:x 2253:tr 2226:// 2211:// 2208:`` 2158:C# 2154:. 2018:re 1882:, 1873:); 1824:); 1781:). 1719:. 1644:-e 1619:\n 1602:. 1590:. 1580:\\ 1498:\? 1487:\\ 1476:\' 1455:\" 1391:) 1383:, 1370:\e 1359:\v 1348:\t 1337:\r 1326:\n 1315:\f 1304:\b 1293:\a 1278:\0 1222:, 1175:\" 1171:\\ 1162:. 1134:); 1131:34 1125:34 1082:%c 1066:34 1045:34 1004:. 994:s, 978:s/ 948:ls 904:: 875:sh 847:q" 823:{} 821:, 817:, 815:() 807:q" 770:R" 744:R" 685:: 656:, 652:, 648:, 598:, 594:, 590:, 586:, 582:, 570:. 382:35 325:); 270:, 146:m4 30:A 3198:. 3173:. 3148:. 3121:. 3074:. 3049:. 3008:. 2973:. 2943:. 2848:, 2833:. 2762:. 2728:. 2678:. 2650:. 2622:. 2520:C 2500:; 2463:; 2436:; 2430:, 2424:, 2385:; 2376:; 2370:= 2364:; 2358:= 2341:F 2337:f 2333:R 2329:r 2259:y 2229:/ 2223:y 2152:b 2144:U 2140:u 2136:B 2132:b 2120:R 2116:r 2079:] 2070:, 2064:[ 2061:= 2058:l 2042:) 2027:( 2021:. 1973:; 1967:= 1961:* 1948:; 1939:= 1933:* 1920:; 1911:= 1905:* 1867:+ 1861:( 1855:; 1849:+ 1843:= 1840:s 1837:* 1815:( 1809:; 1800:= 1797:s 1794:* 1760:+ 1752:+ 1551:\ 1379:( 1128:, 1122:, 1116:, 1107:, 1101:( 1095:; 1069:) 1063:( 1057:+ 1051:+ 1048:) 1042:( 1036:+ 1002:, 998:, 990:/ 986:/ 982:/ 951:= 937:] 861:" 840:. 834:/ 811:" 803:D 795:" 787:. 764:, 762:" 756:) 750:( 699:+ 693:+ 600:J 541:. 488:s 464:" 356:; 353:x 350:= 344:; 338:= 313:, 301:, 289:( 286:= 244:| 241:: 232:: 226:- 170:C 20:)

Index

Literal string
literal
bracket delimiters
Double quotations
empty string
typewriter
regular expressions
PostScript
m4
backtick
apostrophe
Tcl
C
Unicode
Visual Basic .NET
MediaWiki
YAML
whitespace
FORTRAN
Hollerith notation
delimiter
overhead
delimiter collision
metacharacters
programmers
Delimiter collision
delimiter collision
Pascal
BASIC
DCL

Text is available under the Creative Commons Attribution-ShareAlike License. Additional terms may apply.

โ†‘