This course is currently a work in progress. Please join the waitlist to receive regular updates.

Concatenate string variables in apex

Concatenation is the process of joining two strings together. To concatenate strings in apex, use the + operator.

Following is an example of concatenating two strings in apex:

Loading...

In the above example, we concatenated two string variables string1 and string2 and assigned the result to another string variable finalString.

Why concatenate strings in apex

In Apex, string concatenation is used to combine multiple text values into one. For example, you can merge street, city, state, and postal code fields to display an address in a single line. This makes it easy to format and present data clearly.

Try It Yourself

Loading...