The next two examples demonstrate various methods for comparing
strings. To understand how one
string can be “greater than” or “less than” another, consider the process of alphabetizing a series of last names. The reader would, no doubt, place
"Smith", because the first letter of
"Jones" comes before the first letter of
"Smith" in the alphabet. The alphabet is more than just a set of 26 letters—it’s an ordered list of characters in which each letter occurs in a specific position. For example, Z is more than just a letter of the alphabet; it’s specifically the twenty-sixth letter of the alphabet. Computers can order characters alphabetically because they’re represented internally as numeric codes and those ...