As I read your example another idea comes to mind.
Are the strings predictable? Are the non-numerics always in the same place?
If yes, ignore them and only store the numbers.
for the numbers, use packed decimal format. It is VERY easy to encode/decode with picbasic. Packed decimal stores 2 numbers per byte by using a nibble per digit.
Example:
14332569 = 8 bytes
Store the hex as: 14 33 25 69 = 4 bytes
You can encode/decode by simply shifting the data on the byte.
If you 40 chars were 36 numbers plus 4 alphas, the result would be 18 bytes which you could decode and reinsert the alphas in the appropriate places.
If the alphas could appear anywhere but are always 1 of a small set of possibilities your still in luck. The packed decimal uses 0-9 but still leaves you a-f for your own use (6 special characters).
another example:
Lets assume ";" = A "=" = B
Then 12254324;3654=6554 (18 bytes) would encode as:
hex= 12 25 43 24 A3 65 4B 65 54 (9 bytes)
are we getting closer?
ps: I just read your comment about your entire character set. This is good news because it means you could definately use the packed decimal format for 2:1 encoding with low code overhead.
Bookmarks