HTBasic Help
×
Menu
Index

Sub-Order Numbers

 
Sometimes it is useful to assign several characters the same order number, yet still collate them in a specific order. For example, it might make sense to assign all occurrences of "E", regardless of the accent, the same order number, but still allow them to be collated in a specific order. This can be accomplished using sub-order numbers. Sub-order numbers can range from 0 to 63. To assign a sub-order number to a character, set the lower byte of the order table entry to the sub-order value plus 192.
 
When strings are compared, if the order numbers of two characters are the same, the sub-order numbers are used to determine the lexical order. If a sub-order number has not been explicitly assigned to a character, 0 is used. A sub-order number can not be assigned to characters that are used in Ignore, 2-to-1, or 1-to-2 translations since the lower byte of the order table entry is already used.
 
As an example of sub-order number usage, say we wish to give "H" and "I" the same order number, 7, but wish "H" to collate before "I" using sub-order numbers. We can give "H" a sub-order number of 0 and "I" a sub-order number of 1:
 
80 A(NUM("H"))=SHIFT(7,-8)+192+0
90 A(NUM("I"))=SHIFT(7,-8)+192+1