Ordering of characters and strings

Alfred Strohmeier, Christian Genillard, Mats Weber · ACM SIGAda Ada Letters · 1990

Arranging characters and strings in order of representation codes is not suitabl e for application programming .Even when character ordering is logical, the usual filing o f words in dictionaries does not correspond with the mathematical lexicographic ordering of strings, but some equivalence relation on characters is involved .As a solution to thi s problem, we propose a generic package .The paper also explains the theory behind th e solution .Some definitions of classical mathematics are recalled in the appendix . STATEMENT OF THE PROBLE MArranging characters, and by extension strings, in order of representation codes may b e convenient and efficient when the effect is hidden in a program, but it is clearly not suitabl e for application programming .For instance the ordering : (1 .1)A<a<B <b< . . .<Z< z may be more appropriate than the well-known ASCII collating sequence : (1 .2) A<B< . ..<Z< . ..<a<b< ...< z Lexicographic ordering of strings based on ASCII codes (1 .2) yields : (1 .3)A<Ada<Adam< . ..<B<BA<Ba< . ..<a<ad<adag e and when based on logical order (1 .1), the result would be : (1 .4)A<Ada<Adam < . ..<a<ad<adage < .. .<B<BA<BaBut a dictionary would file these words as : (1 .5)A<a<ad<Ada<adage <Adam < ... <B <BA<Ba< ... This sequence can be produced by a two step sorting : first, the words are sorted i n lexicographic order based on (1 .1)but ignoring case differences, and, secondly, equivalen t strings, i.e. words differing by their case only, are sorted among each other .When diacritical marks are added to letters, or when special characters are part of strings , the situation is similar, although more cornplicated .For instance in Webster's dictionar y [WEBSTER], one may observe the following sequence : ably < ABM < Abnaki < ... < abo < Abo < aboard < . . .< abomasum < A-bomb < abominable < . . .< abomination < a bon marche < aboriginal < . . .< all < . . .< alloy < all-purpose < all right < alI-right < all-round < All Saint's Day < allseed < . . .< HBP < h .c. < HC < .. .<ILS <I'm<im-<image < . . .

Read the paper · More papers on PaperTik