Arranging characters and strings in order of representation codes is not suitable for application programming. Even when character ordering is logical, the usual filing of 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 this problem, we propose a generic package. The paper also explains the theory behind the solution. Some definitions of classical mathematics are recalled in the appendix.