Lably
Skip to content

Comparison of programming languages (strings)

  • 2 min read
  • 2 chapters

Related on Lably

Through String (computer science), Data structure and Unix shell

Concatenation

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

Common variants

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) 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.

Sign in to keep reading

One more chapter is free with a Lably account.

More in Computing and communication