Concatenation of Strings
The process of combining more than one string together is known as Concatenation. String Concatenation is the technique of combining two strings.
There are two ways to concatenate two strings:
Below is the algorithm for the Concatenation of two strings:
Algorithm: CONCATENATE (STR1, STR2, STR3)
1. LEN1 = LENGTH(STR1).
2. LEN2 = LENGTH(STR2).
3. SET I = 0.
4. Repeat Steps 5 and 6 while I < LEN1-1:
5. STR3[I] = STR1[I].
6. SET I = I+1.
7. SET J = 0.
8. Repeat Steps 9 to 11 while I < (LEN1 + LEN2 - 2):
9. STR3[I] = STR2[J].
10. J = J+1.
11. I = I+1.
12.Exit.
Contact Us