Post by tsh73 on Mar 27, 2020 13:02:23 GMT
It is known (but hardly remembered) that JB has his own character order
I does affect sorting (built-in as well as any user program), and it does affect string comparison.
So if you need to (say filter) letters from A to H, first code let lower case letter in, too
Second code does what I just asked.
So I think you *REALLY* should be aware of it. It is NOT CONVENTIONAL.
ordering, compared to (extended)ASCII
I does affect sorting (built-in as well as any user program), and it does affect string comparison.
So if you need to (say filter) letters from A to H, first code let lower case letter in, too
Second code does what I just asked.
for i = 32 to 255
if chr$(i)>="A" And chr$(i)<="H" then print chr$(i);
next
print
for i = 32 to 255
if i>=asc("A") And i<=asc("H") then print chr$(i);
next
print
ABCDEFGHabcdefg
ABCDEFGH
So I think you *REALLY* should be aware of it. It is NOT CONVENTIONAL.
ordering, compared to (extended)ASCII
ASCII order
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 ................
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 ................
32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 !"#$%&'()*+,-./
48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 0123456789:;<=>?
64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 @ABCDEFGHIJKLMNO
80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 PQRSTUVWXYZ[\]^_
96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 `abcdefghijklmno
112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 pqrstuvwxyz{|}~
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 ‘’“”•–—˜™š›œžŸ
160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 ¡¢£¤¥¦§¨©ª«¬®¯
176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 °±²³´µ¶·¸¹º»¼½¾¿
192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏ
208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 ÐÑÒÓÔÕÖ×ØÙÚÛÜÝÞß
224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 àáâãäåæçèéêëìíîï
240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 ðñòóôõö÷øùúûüýþÿ
LibertyBASIC order
0 173 1 2 3 4 5 6 7 8 14 15 16 17 18 19 ...............
20 21 22 23 24 25 26 27 28 29 30 31 127 39 45 150 ............'-–
151 32 160 9 10 11 12 13 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 166 145 146 130 147 148 132 139 155 164 136 43 60 61 }~¦‘’‚“”„‹›¤ˆ+<=
62 177 171 187 167 169 172 174 176 181 182 183 133 134 135 149 >±«»§©¬®°µ¶·…†‡•
137 152 48 49 50 51 52 53 54 55 56 57 65 97 66 98 ‰˜0123456789AaBb
67 99 68 100 69 101 70 102 71 103 72 104 73 105 74 106 CcDdEeFfGgHhIiJj
75 107 76 108 77 109 78 110 185 79 111 80 112 81 113 82 KkLlMmNn¹OoPpQqR
114 83 115 84 116 153 85 117 86 118 87 119 88 120 89 121 rSsTt™UuVvWwXxYy
90 122 192 224 193 225 194 226 195 227 129 131 165 180 196 228 ZzÀàÁáÂâÃュ´Ää
128 144 197 229 168 184 170 186 198 230 199 231 189 190 200 232 €Å娸ªºÆæÇç½¾Èè
178 179 175 191 201 233 163 188 202 234 141 157 203 235 138 154 ²³¯¿É飼ÊêË늚
204 236 205 237 140 156 206 238 207 239 208 240 209 241 210 242 ÌìÍ팜ÎîÏïÐðÑñÒò
142 158 211 243 161 162 212 244 213 245 214 246 215 247 143 159 ŽžÓó¡¢ÔôÕõÖö×÷Ÿ
216 248 217 249 218 250 219 251 220 252 221 253 222 254 223 255 ØøÙùÚúÛûÜüÝýÞþßÿ
code'Liberty/justBASIC string sorting vs ASCII sort
'just in case you don't know
'fill table
dim a$(255,2)
for i = 0 to 255
a$(i,1)=chr$(i)
a$(i,2)=str$(i)
next
print "ASCII order"
gosub [printTable]
'sort table (bubble sort)
for i = 254 to 0 step -1
FOR j = 0 to i
if a$(j,1)>a$(j+1,1) then
tmp$ = a$(j,1)
a$(j,1)=a$(j+1,1)
a$(j+1,1)=tmp$
tmp$ = a$(j,2)
a$(j,2)=a$(j+1,2)
a$(j+1,2)=tmp$
end if
next
next
print
print "LibertyBASIC order"
gosub [printTable]
end
[printTable]
print
for i = 0 to 15
for j = 0 to 15
k=i*16+j
print using("####",val(a$(k,2)));
next
print,
for j = 0 to 15
k=i*16+j
if asc(a$(k,1))<32 then print "."; else print a$(k,1);
next
print
next
return