Comparison of programming languages (strings): Difference between revisions

Content deleted Content added
String literals: Fix a couple incorrect entries, add warning comments, rename "heredoc" section to "multiline string"
String literals: Put more capable syntaxes first, which will hopefully deter people from adding syntaxes to sections that don't reflect their full capabilities
Line 68:
== String literals ==
This section compares styles for declaring a [[string literal]].
 
=== Quoted raw ===
"Raw" meaning that the interpreter/compiler does not recognize any variable or constant identifiers located inside the string and the content of the identifier will not replace the identifier in the string.
<!-- Before you add your favorite language to this table, make sure it's not listed in another section. -->
{| class="wikitable"
|-
! Syntax
! Language(s)
|-
| <tt>@"Hello, world!"</tt>
| C#, F#
|-
| <tt>"Hello, world!"</tt>
| Cobol, FreeBASIC, Java, JavaScript, Pick Basic
|-
| <tt>r"Hello, world!"</tt>
| D, Python, Cobra
|-
| <tt>'Hello, world!'</tt>
| APL, CoffeeScript, Fortran, Object Pascal, Pascal, Perl, PHP, Pick Basic, Windows PowerShell, Smalltalk
|-
| <tt>`Hello, world!`</tt>
| D, Go
|-
| <tt>R"(Hello, world!)"</tt>
| C++11
|}
 
=== Quoted interpolated ===
Line 151 ⟶ 124:
| <tt>!"I said \"Hello, world!\""</tt>
| FreeBASIC
|}
 
=== Quoted raw ===
"Raw" meaning that the interpreter/compiler does not recognize any variable or constant identifiers located inside the string and the content of the identifier will not replace the identifier in the string.
<!-- Before you add your favorite language to this table, make sure it's not listed in another section. -->
{| class="wikitable"
|-
! Syntax
! Language(s)
|-
| <tt>@"Hello, world!"</tt>
| C#, F#
|-
| <tt>"Hello, world!"</tt>
| Cobol, FreeBASIC, Java, JavaScript, Pick Basic
|-
| <tt>r"Hello, world!"</tt>
| D, Python, Cobra
|-
| <tt>'Hello, world!'</tt>
| APL, CoffeeScript, Fortran, Object Pascal, Pascal, Perl, PHP, Pick Basic, Windows PowerShell, Smalltalk
|-
| <tt>`Hello, world!`</tt>
| D, Go
|-
| <tt>R"(Hello, world!)"</tt>
| C++11
|}