Numerical and chronological Strings representing
numbers may be sorted based on the values of the numbers that they represent. For example, "−4", "2.5", "10", "89", "30,000". Pure application of this method may provide only a partial ordering on the strings, since different strings can represent the same number (as with "2" and "2.0" or, when
scientific notation is used, "2e3" and "2000"). A similar approach may be taken with strings representing
dates or other items that can be ordered chronologically or in some other natural fashion.
Alphabetical Alphabetical order is the basis for many systems of collation where items of information are identified by strings consisting principally of
letters from an
alphabet. The ordering of the strings relies on the existence of a standard ordering for the letters of the alphabet in question. (The system is not limited to alphabets in the strict technical sense; languages that use a
syllabary or
abugida, for example
Cherokee, can use the same ordering principle provided there is a set ordering for the symbols used.) To decide which of two strings comes first in alphabetical order, initially their first letters are compared. The string whose first letter appears earlier in the alphabet comes first in alphabetical order. If the first letters are the same, then the second letters are compared, and so on, until the order is decided. (If one string runs out of letters to compare, then it is deemed to come first; for example, "cart" comes before "carthorse".) The result of arranging a set of strings in alphabetical order is that words with the same first letter are grouped together, and within such a group words with the same first two letters are grouped together, and so on.
Capital letters are typically treated as equivalent to their corresponding lowercase letters. (For alternative treatments in computerized systems, see
Automated collation, below.) Certain limitations, complications, and special conventions may apply when alphabetical order is used: • When strings contain
spaces or other word dividers, the decision must be taken whether to ignore these dividers or to treat them as symbols preceding all other letters of the alphabet. For example, if the first approach is taken then "car park" will come after "carbon" and "carp" (as it would if it were written "carpark"), whereas in the second approach "car park" will come before those two words. The first rule is used in many (but not all)
dictionaries, the second in
telephone directories (so that Wilson, Jim K appears with other people named Wilson, Jim and not after Wilson, Jimbo). • Abbreviations may be treated as if they were spelt out in full. For example, names containing "St." (short for the English word
Saint) are often ordered as if they were written out as "Saint". There is also a traditional convention in English that surnames beginning
Mc and
M' are listed as if those prefixes were written
Mac. • Strings that represent personal names will often be listed by alphabetical order of surname, even if the
given name comes first. For example, Juan Hernandes and Brian O'Leary should be sorted as "Hernandes, Juan" and "O'Leary, Brian" even if they are not written this way. • Very common initial words, such as
The in English, are often ignored for sorting purposes. So
The Shining would be sorted as just "Shining" or "Shining, The". • When some of the strings contain
numerals (or other non-letter characters), various approaches are possible. Sometimes such characters are treated as if they came before or after all the letters of the alphabet. Another method is for numbers to be sorted alphabetically as they would be spelled: for example
1776 would be sorted as if spelled out "seventeen seventy-six", and as if spelled "vingt-quatre..." (French for "twenty-four"). When numerals or other symbols are used as special graphical forms of letters, as in
1337 for
leet or
Se7en for the movie title
Seven, they may be sorted as if they were those letters. • Languages have different conventions for treating
modified letters and certain letter combinations. For example, in
Spanish the letter
ñ is treated as a basic letter following
n, and the
digraphs ch and
ll were formerly (until 1994) treated as basic letters following
c and
l, although they are now alphabetized as two-letter combinations. A list of such conventions for various languages can be found at . In several languages the rules have changed over time, and so older dictionaries may use a different order than modern ones. Furthermore, collation may depend on use. For example, German
dictionaries and
telephone directories use different approaches. == Root sorting ==