Concatenate

Updated: 05/02/2021 by Computer Hope

Concatenate, concatenation, or concat describes combining a string, text, or other data in a series without any gaps. In programming languages, a function like strcat (string concatenation in C) or an operator is used to denote concatenation. For example, In the Java programming language, the operator "+" denotes concatenation, as it does in other programming languages.

C strcat() function

In the following example, the C function strcat would concatenate two strings contained in str1 and str2 together.

strcat(str1, str2);

Java concatenate

In the below Java example using the "+" operator on the string "Hello," and the string " how are you?" would produce the single string "Hello, how are you?" when the program runs.

System.out.println("Hello," + " how are you?");

Perl concatenate

Other programming languages such as Perl can use a period for concatenation. For example, printing the same "Hello, how are you?" text in Perl would look similar to the example below.

print "Hello, " . "how are you?";

A variable could also be concatenated into the text as shown in the example below. In this example, the output would be "Hello Nathan, how are you?" when running the script.

my $name = "Nathan";
print "Hello " . $name . ", how are you?";

Excel and spreadsheet concatenate

Concatenate is also an Excel formula function. For example, in the below formula the concatenate function will combine the data in cell A2 with the date in cell B2 with a space delimiter.

=CONCATENATE(A2," ",B2)

Append, Combine, Programming terms, Spreadsheet terms