Separate a Full Name Into First, Middle, and Last Names
If you use a variable in your template for an individual's full name, you may run into situations where you would like to parse (break up) the full name into its individual parts. For example, you may want to alphabetize a list of names by last name, in which case you would need to extract the last names from the full name.
You can use the following computation to parse a full name into first, middle, and last names. If the full name does not contain any spaces, the computation assumes that it is only the first name. If there is only one space, the computation assumes that there is no middle name. Finally, if there are more than two spaces in the name, all characters after the first two spaces are considered part of the last name.