Tip Concatenation

You can combine two or more strings to form a new string. The joining operation is called concatenation. You have seen the example of concatenated strings in the AgeCalc and HowManyCells procedures. Concatenation is represented by an ampersand (&) character. For instance, "His name is " & FirstName will produce the following string: 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 quotes: "His name is ". Concatenation of strings also can be represented by a plus sign (+). However, many programmers prefer to restrict the plus sign to operations on numbers to eliminate ambiguity.

0 0

Post a comment