Home / Definitions / Concatenation

Concatenation

Vangie Beal
Last Updated May 24, 2021 7:38 am

Concatenation, broadly speaking, is the linking or joining of two things to achieve a certain result. In computer programming, it links two characters or character strings together to create a phrase or compound word. This process is also known as string theory. Concatenating two separate files requires the user to append one to the other (rather than inserting).

Concatenation is mathematical, using algebraic processes to join characters into strings and strings into different strings. Symbols known as operators join the character strings together; they differ depending on the programming language being used. These symbols allow users to manipulate the page s text. A common operator is +, which adds two character strings together. Some programming languages don t always need an operator: if two string literals are joined in C++ or Python, they may not require one. A literal is itself a value, and it can be a character or a string.

In Python, each character exists as its own immutable string. Concatenation requires two strings (not a string and an integer; this triggers an error). Four methods of concatenation in Python include + operator, % operator, format () function, and join() method. Again, + operator is common and simple in Python.