Formatting and Sorting Strings
Another typical task you might want to do is to sort a group of names. Script 8.6 combines the previous two examples and adds a sort. The end result is the list of names in last-name order, properly capitalized, and alphabetized.
Script 8.6. This script takes a bunch of names in any format and order and turns them into a neat and orderly list.
To format and sort strings: