Comparison of programming languages (strings)

From Wikipedia, the free encyclopedia

This comparison of programming languages (strings) compares the features of string data structures or text-string processing for over 52 various computer programming languages.

Common variants

Different languages use different symbols for the concatenation operator. Many languages use the "+" symbol, though several deviate from this.

Operator Languages
+ ALGOL 68, BASIC, C++, C#, Cobra, Dart, Eiffel, F#, Go, Java, JavaScript, Object Pascal, Pascal, Python, Ruby, Rust, Scala, Swift, Turing, Windows PowerShell, Ya
++ Elm, Erlang, Haskell
$+ mIRC scripting language
& Ada, AppleScript, COBOL (for literals only), Curl, Excel, FreeBASIC, HyperTalk, Nim, Seed7, VHDL, Visual Basic, Visual Basic (.NET)
concatenate Common Lisp
. Autohotkey, Maple (up to version 5), Perl, PHP
~ D, Raku, Symfony (Expression Language component)
|| Icon, Maple (from version 6), PL/I, Rexx, Standard SQL
<> Mathematica, Wolfram Language, Elixir
.. Lua
: Pick Basic
, APL, J, Smalltalk
^ F#, OCaml, rc, Standard ML
// Fortran
* Julia

Unique variants

  • AWK uses the empty string: two expressions adjacent to each other are concatenated. This is called juxtaposition. Unix shells have a similar syntax. Rexx uses this syntax for concatenation including an intervening space.
  • C (along with Python and Dart[1]) allows juxtaposition for string literals, however, for strings stored as character arrays, the strcat function must be used.
  • COBOL uses the STRING statement to concatenate string variables.
  • MATLAB and Octave use the syntax "[x y]" to concatenate x and y.
  • Visual Basic and Visual Basic .NET can also use the "+" sign but at the risk of ambiguity if a string representing a number and a number are together.
  • Microsoft Excel allows both "&" and the function "=CONCATENATE(X,Y)".
  • Rust has the concat! macro and the format! macro, of which the latter is the most prevalent throughout the documentation and examples.

String literals

Notes

References

Related Articles

Wikiwand AI