Dictionary sort order

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Dictionary sort order

Bob Zawalich
One of the joys of Sib 6 and later is Dictionaries, which among other
things, we do a very fast sort for you. If you enter text as the key of an
dictionary and then read the keys out, they appear in sorted order. It turns
out to be a case insensitive order. I was trying to find a character in the
" ascii range" (32 to 265) that would sort after the letters.

There are none. Everything sorts before the letters. Here is a bit of code I
wrote to test this, and the results, FWIW.

What is mildly interesting to me is that the upper and lower case for a
given letter may be in different orders.  We Have Aa Bb Cc but from dD on,
We have the lower case letter sorting before the upper. No big deal mostly,
but one would expect consistency. Once the upper 128 chars come in the accented letters fill in as well.


dict = CreateDictionary();

for i = 32 to 256
{
        str = Chr(i) & " " & i;
        dict [str] = i;
}

for each Name name in dict
{
        trace(name); // we will see the character, a space, and the index of
the character
}


*************************
  32
 127
­ 173
' 39
- 45
  160
! 33
" 34
# 35
$ 36
% 37
& 38
( 40
) 41
* 42
, 44
. 46
/ 47
: 58
; 59
? 63
@ 64
[ 91
\ 92
] 93
^ 94
_ 95
` 96
{ 123
| 124
} 125
~ 126
¡ 161
¦ 166
¨ 168
¯ 175
´ 180
¸ 184
¿ 191
¢ 162
£ 163
¤ 164
¥ 165
+ 43
< 60
= 61
> 62
± 177
« 171
» 187
× 215
÷ 247
§ 167
© 169
¬ 172
® 174
° 176
µ 181
¶ 182
· 183
€ 128
 129
‚ 130
ƒ 131
„ 132
… 133
† 134
‡ 135
ˆ 136
‰ 137
Š 138
‹ 139
Π140
 141
Ž 142
 143
 144
‘ 145
’ 146
“ 147
” 148
• 149
– 150
— 151
˜ 152
™ 153
š 154
› 155
œ 156
 157
ž 158
Ÿ 159
0 48
¼ 188
½ 189
¾ 190
¹ 185
1 49
² 178
2 50
³ 179
3 51
4 52
5 53
6 54
7 55
8 56
9 57
ª 170
À 192
Á 193
 194
à 195
Ä 196
Å 197
à 224
á 225
â 226
ã 227
ä 228
å 229
A 65
a 97
Æ 198
æ 230
B 66
b 98
Ç 199
ç 231
C 67
c 99
d 100
Ð 208
ð 240
D 68
e 101
È 200
É 201
Ê 202
Ë 203
è 232
é 233
ê 234
ë 235
E 69
f 102
F 70
g 103
G 71
h 104
H 72
i 105
Ì 204
Í 205
Î 206
Ï 207
ì 236
í 237
î 238
ï 239
I 73
j 106
J 74
k 107
K 75
l 108
L 76
m 109
M 77
n 110
Ñ 209
ñ 241
N 78
o 111
º 186
Ò 210
Ó 211
Ô 212
Õ 213
Ö 214
Ø 216
ò 242
ó 243
ô 244
õ 245
ö 246
ø 248
O 79
p 112
P 80
q 113
Q 81
r 114
R 82
s 115
S 83
ß 223
t 116
T 84
Þ 222
þ 254
u 117
Ù 217
Ú 218
Û 219
Ü 220
ù 249
ú 250
û 251
ü 252
U 85
v 118
V 86
w 119
W 87
x 120
X 88
y 121
Ý 221
ý 253
ÿ 255
Y 89
z 122
Z 90



_______________________________________________
Plugin-dev mailing list
[hidden email]
http://avid-listsrv1.avid.com/mailman/listinfo/plugin-dev