Comparison of programming languages (strings)

This is an old revision of this page, as edited by Gwern (talk | contribs) at 03:23, 13 December 2006 (Robot-assisted disambiguation (you can help!): Python programming language). The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.

Concatenation

Common variants:

Unique variants:

  • Visual Basic uses the "&" sign. Versions 1 to 6 can also use the "+" sign but this leads to ambiguity if a string representing a number and a number is added together.
  • MATLAB uses the syntax "[x y]" to concatenate x and y.
  • C allows juxtaposition for string literals, however, for strings stored as character arrays, the strcat function must be used.
  • Octave uses the syntax "[x, y]" to concatenate x and y.
  • Awk uses the empty string: You just have to write two expressions adjacent to each other to concatenate them. This is called Juxtaposition. Unix shells have a similar syntax. Rexx uses this syntax for concatenation including an intervening space.

String literals

This section compares styles for declaring a string literal.

Quoted raw

   
    <![CDATA[ TheQuickBrownFox ]]> ;; CDATA section ;; XML
    

Quoted interpolated

todo

Dual quoting

todo

Multiple quoting

todo

Unique quoting variants

   16HTheQuickBrownFox          ;; Hollerith notation                   ;; Fortran
   (indented with whitespace)   ;; Indented with whiteapce and newlines ;; YAML