Concatenation

You can combine two or more strings to form a new string. The joining operation is called concatenation. You have seen an example of concatenated strings in the AgeCalc procedure above. Concatenation is represented by an ampersand (&) character. For instance, "His name is " & FirstName will produce a string like: His name is John or His name is Michael. The name of the person is determined by the contents of the FirstName variable. Notice that there is an extra space between "is" and the ending quotation mark: "His name is ". Concatenation of strings can also be represented by a plus sign (+); however, many programmers prefer to restrict the plus sign to numerical operations to eliminate ambiguity.

0 0

Post a comment