Comparison of programming languages (strings): Difference between revisions

Content deleted Content added
m v2.05 - Fix errors for CW project (Reference list missing / disambiguation page with disallowed <ref>)
 
(10 intermediate revisions by 8 users not shown)
Line 1:
{{Unreferenced|date=February 2009}}
{{ProgLangCompare}}
 
Line 8 ⟶ 7:
 
===Common variants===
 
{| class="wikitable"
|-
Line 15 ⟶ 13:
|-
| +
| [[ALGOL 68]], [[BASIC programming language|BASIC]], [[C++]], [[C Sharp (programming language)|C#]], [[Cobra (programming language)|Cobra]], [[Dart (programming_languageprogramming language)|Dart]], [[Eiffel (programming language)|Eiffel]], [[F Sharp (programming language)|F#]], [[Go (programming language)|Go]], [[Java (programming language)|Java]], [[JavaScript]], [[Object Pascal]], [[Objective-C]], [[Pascal (programming language)|Pascal]], [[Python (programming language)|Python]], [[Ruby (programming language)|Ruby]], [[Rust (programming language)|Rust]], [[Scala (programming language)|Scala]], [[Swift (programming language)|Swift]], [[Turing (programming language)|Turing]], [[Windows PowerShell]], Ya
|-
| ++
| [[Erlang (programming language)|Erlang]], [[Haskell (programming language)|Haskell]]
|-
| $+
| [[MIRCmIRC scripting language|mIRC Scripting Language]]
|-
| &
| [[Ada (programming language)|Ada]], [[AppleScript]], [[COBOL]] (for literals only), [[Curl (programming language)|Curl]], [[FreeBASICMicrosoft Excel|Excel]], [[MicrosoftFreeBASIC]], Excel|Excel[[HyperTalk]], [[Nim (programming language)|Nim]], [[Seed7]], [[VHDL]], [[Visual Basic]], [[Visual Basic .NET]]
|-
| concatenate
Line 30 ⟶ 28:
|-
| .
| Autohotkey, [[Maple computer algebra system(software)|Maple]] (up to version 5), [[Perl]], [[PHP]]
|-
| ~
| [[D (programming language)|D]], [[Raku (programming language)|Raku]], [[Symfony]] (Expression Language component)
|-
| <nowiki>||</nowiki>
| [[Icon (programming language)|Icon]], [[Maple computer algebra system(software)|Maple]] (from version 6), [[PL/I]], [[Rexx]], Standard [[SQL]]
|-
| <>
| [[Mathematica]], [[Wolfram Language]], [[Elixir (programming language)|Elixir]]
|-
| ..
| [[Lua (programming language)|Lua]]
|-
| :
| [[Pick Basic]]
|-
| ,
| [[APL (programming language)|APL]], [[J (programming language)|J]], [[Smalltalk]]
|-
| ^
| [[F Sharp (programming language)|F#]], [[OCaml]], [[Rc (Unix shell)|rc]], [[Standard ML]]
|-
| //
Line 62 ⟶ 60:
===Unique variants===
 
* [[AwkAWK]] uses the empty string: two expressions adjacent to each other are concatenated. This is called [[Juxtaposition (literary)|juxtaposition]]. [[Unix shell]]s have a similar syntax. [[Rexx]] uses this syntax for concatenation including an intervening space.
* [[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 programming language|Octave]] use the syntax "<code>[x y]</code>" to concatenate x and y.
* [[Visual Basic]] and [[Visual Basic .NET]] can also use the "<code>+</code>" sign but at the risk of ambiguity if a string representing a number and a number are together.
* [[Microsoft Excel]] allows both "<code>&</code>" and the function "<code>=CONCATENATE(X,Y)</code>".
Line 94 ⟶ 92:
|-
| <code>"Hello, #{name}!"</code>
| CoffeeScript, Ruby, [[Elixir (programming language)|Elixir]]
|-
| <code>%Q(Hello, #{name}!)</code>
Line 100 ⟶ 98:
|-
| <code>(format nil "Hello, ~A" name)</code>
|[[Common Lisp]]
|-
| <code>`Hello, ${name}!`</code>
Line 143 ⟶ 141:
| {{nowrap|<code>r#"I said "Hello, world!""#</code>}}
|Rust (alternate)
|-
| {{nowrap|<code>R"("I said "Hello, world!")"</code>}}
|C++ (alternate)
|}
 
Line 251 ⟶ 252:
"</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"
Line 295 ⟶ 304:
: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