Content deleted Content added
→Quoted interpolated: Remove confusing tautology |
Aadirulez8 (talk | contribs) m v2.05 - Fix errors for CW project (Reference list missing / disambiguation page with disallowed <ref>) |
||
(34 intermediate revisions by 25 users not shown) | |||
Line 1:
{{ProgLangCompare}}
Line 8 ⟶ 7:
===Common variants===
{| class="wikitable"
|-
Line 15 ⟶ 13:
|-
| +
| [[ALGOL 68]], [[
|-
| ++
| [[
|-
| $+
| [[
|-
| &
| [[Ada (programming language)|Ada]], [[AppleScript]], [[COBOL]] (for literals only), [[Curl (programming language)|Curl]], [[
|-
| concatenate
| [[Common Lisp]]
|-
| .
| Autohotkey, [[
|-
| ~
| [[
|-
| <nowiki>||</nowiki>
| [[Icon (programming language)|Icon]],
|-
| <>
| [[Mathematica]], [[Wolfram Language]], [[Elixir (programming language)|Elixir]]
|-
| ..
| [[Lua (programming language)|Lua]]
|-
| :
| [[Pick Basic]]
|-
| ,
| [[
|-
| ^
| [[
|-
| //
| [[Fortran]]
|-
| [[Julia (programming language)|Julia]]
|}
===Unique variants===
* [[
* [[C (programming language)|C]] (along with [[Python (programming language)|Python]] and [[Dart (programming language)|Dart]]<ref>{{Cite web |title=Built-in types |url=https://dart.dev/language/built-in-types/ |access-date=2025-07-22 |website=dart.dev |language=en}}</ref>) allows juxtaposition for string literals, however, for strings stored as [[Character (computing)|character]] [[Array data structure|arrays]], the <code>[[strcat]]</code> function must be used.
* [[COBOL]] uses the <code>STRING</code> statement to concatenate string variables.
* [[MATLAB]] and [[GNU Octave
* [[Visual Basic]]
* [[Microsoft Excel]] allows both "<code>&</code>" and the function "<code>=CONCATENATE(X,Y)</code>".
* [[Rust (programming language)|Rust]] has the <code>concat!</code> macro and the <code>format!</code> macro, of which the latter is the most prevalent throughout the documentation and examples.
== String literals ==
Line 77 ⟶ 79:
! Language(s)
|-
| <
| C#, Visual Basic .NET
▲| C#
|-
| <
| [[Bourne shell]], Dart, Perl, PHP, Windows PowerShell
|-
| <
| Perl (alternate)
|-
| <
| PHP (alternate)
|-
| <
| CoffeeScript, Ruby, [[Elixir (programming language)|Elixir]]
|-
| <
| Ruby (alternate)
|-
| <
|[[Common Lisp]]
|-
| <
| JavaScript (ECMAScript 6)
|-
| <
| Swift
|-
| <code>f'Hello, {name}!'</code>
| Python
|}
Line 113 ⟶ 118:
! Language(s)
|-
| <
| C, C++, C#, D, Dart, F#, Java, JavaScript, Mathematica, Ocaml, Perl, PHP, Python, Rust, Swift, Wolfram Language, Ya
|-
| {{nowrap|<
| CoffeeScript, Dart (alternate), JavaScript (alternate), Python (alternate)
|-
| <
| Windows Powershell
|-
| <
| REBOL
|-
| <
| REBOL (alternate)
|-
| <
| Eiffel
|-
| <
| FreeBASIC
|-
| {{nowrap|<code>r#"I said "Hello, world!""#</code>}}
|Rust (alternate)
|-
| {{nowrap|<code>R"("I said "Hello, world!")"</code>}}
|C++ (alternate)
|}
Line 143 ⟶ 154:
! Language(s)
|-
| <
| Ada, ALGOL 68, COBOL, Excel, Fortran, FreeBASIC, Visual Basic
|-
| <
|
|}
Line 158 ⟶ 169:
! Language(s)
|-
| <
| APL, Bourne shell, Fortran, Object Pascal, Pascal, Perl, PHP, Pick Basic, Ruby, Smalltalk, Windows PowerShell
|-
| <
| Perl (alternate)
|-
| <
| Ruby (alternate)
|-
| <
| C++11
|-
| <
| C#, F#
|-
| <
| Cobra, D, Dart, Python,
|-
| <
| Dart (alternate)
|-
| <code>"Hello, world!"</code>
| Cobol, FreeBASIC, Pick Basic
|-
| <
| D, Go
|-
| <
| Scala
|-
| <code>String.raw`Hello, World!`</code>
| JavaScript (ECMAScript 6) {{ref|es6rawstr}}
|}
Line 192 ⟶ 209:
|-
! Syntax
! Here
! Language(s)
|-
| <pre><<EOF
I have a lot of things to say
| Yes▼
and so little time to say them
| Bourne shell, Perl, PHP, Ruby▼
EOF</pre>
▲| {{Yes}}
|-
| <
I have a lot of things to say and so little time to say them EOF</ | {{Yes}}
| PHP
|-
| <pre>@"
I have a lot of things to say
| No▼
and so little time to say them
"@</pre>
▲| {{No}}
| Windows Powershell
|-
| <pre>"[
I have a lot of things to say
| No▼
and so little time to say them
]"</pre>
▲| {{No}}
| Eiffel
|-
| <pre>"""
I have a lot of things to say
| No▼
and so little time to say them
| CoffeeScript, Python, Groovy, Swift▼
"""</pre>
▲| {{No}}
|-
|<pre>"
I have a lot of things to say
and so little time to say them
"</pre>
| {{No}}
|[[Common Lisp]] (all strings are multiline), Rust (all strings are multiline), Visual Basic .NET (all strings are multiline)
|-
| <pre>R"(
I have a lot of things to say
and so little time to say them
)"
</pre>
| {{No}}
| C++
|-
| <pre>r"
I have a lot of things to say
and so little time to say them
"</pre>
| {{No}}
| Rust
|-
| <pre>[[
I have a lot of things to say
and so little time to say them
]]</pre>
| {{No}}
| Lua
|-
| <pre>`
I have a lot of things to say
and so little time to say them
`</pre>
| {{No}}
| JavaScript (ECMAScript 6)
|}
Line 224 ⟶ 292:
! Language(s)
|-
| <
| Hollerith notation
| Fortran 66
Line 232 ⟶ 300:
| YAML
|}
== Notes ==
:1. {{note|es6rawstr}} <code>String.raw``</code> still processes string interpolation.
==References==
{{Reflist}}
:1. {{note|es6rawstr}} https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/raw
[[Category:Programming language comparisons|*Strings]]
|