Suvarna Garge (Editor)

Comparison of programming languages (strings)

Updated on
Edit
Like
Comment
Share on FacebookTweet on TwitterShare on LinkedInShare on Reddit

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

Contents

Concatenation

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

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) 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 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.
  • Microsoft Excel allows both "&" and the function "=CONCATENATE(X,Y)".
  • String literals

    This section compares styles for declaring a string literal.

    Quoted raw

    "Raw" meaning that the interpreter/compiler does not recognize any variable or constant identifiers located inside the string and the content of the identifier will not replace the identifier in the string.

    Quoted interpolated

    "Interpolated" means that the interpreter/compiler does recognize a variable or constant identifier located inside the string and the content of the identifier will replace the identifier in the string.

    Escaped quotes

    "Escaped" quotes means that a 'flag' symbol is used to warn that the character after the flag is used in the string rather than ending the string.

    Dual quoting

    "Dual quoting" means that whenever a quote is used in a string, it is used twice, and one of them is discarded and the single quote is then used within the string.

    Unique quoting variants

    References

    Comparison of programming languages (strings) Wikipedia