*** Welcome to piglix ***

String concatenation


In formal language theory and computer programming, string concatenation is the operation of joining character strings . For example, the concatenation of "snow" and "ball" is "snowball". In some but not all formalisations of concatenation theory, also called string theory, string concatenation is a primitive notion.

In many programming languages, string concatenation is a binary infix operator. The + (plus) operator is often overloaded to denote concatenation for string arguments: "Hello, " + "World" has the value "Hello, World". In other languages there is a separate operator, particularly to specify implicit type conversion to string, as opposed to more complicated behavior for generic plus. Examples include . in Edinburgh IMP, Perl, and PHP, and & in Ada and Visual Basic. Other syntax exists, like || in PL/I and Oracle Database SQL.

In a few languages, notably C, C++, and Python, there is string literal concatenation, meaning that adjacent string literals are concatenated, without any operator: "Hello, " "World" has the value "Hello, World". In other languages, concatenation of string literals with an operator is evaluated at compile time, via constant folding.

In programming, string concatenation generally occurs at run time, as string values are not in general known until run time. However, in the case of string literals, the values are known at compile time, and thus string concatenation can be done at compile time, either via string literal concatenation or via constant folding.


...
Wikipedia

...