String Operations
In addition to basic comparisons, developers writing scripts also must often manipulate strings in other ways. Concatenation is the most common string operation; it allows the developer to combine two strings together. For example, imagine that we have the following variables:
first = "Mike"
last = "Chapple"
We might want to combine these names into a single string to make it easier to manipulate. We can do this by concatenating the two strings. Here’s some pseudocode using the + operator for concatenation:
name = first + last
This would result in the following value:
MikeChapple
Of course, We’d like a space in between those values, so I can just concatenate it into the string
name = first + " " + last
which would result in the value
Mike Chapple
We also might need to concatenate a string and an integer together. Here’s some pseudocode that performs string and integer concatenation by first converting the integer...