Compress a string

  • Thread starter Thread starter Darren B
  • Start date Start date
D

Darren B

I have a long string, actually a MAPI entry ID that I want to compress down
for storing into a database. An example is:
"0000000020CCCFAC05C0B14B920BE916F0ADEC54070012EA1E9997A09B4391EA8D617B81A95
3000000004E46000012EA1E9997A09B4391EA8D617B81A953000000005D820000"

Anybody have any ides On how this could be performed. It's not mission
critical so we would prefer not to buy 3rd party tools.

Cheers,
 
Darren,

The best way I could think of to do this would be to actually represent
the number in a byte array. Since the number is a hexidecimal value, the
first four zeros could be stored as one byte. Do this to the whole string,
and you would need only 35 bytes instead of the 140 you would need to store
the string itself.

Hope this helps.
 
Darren,

I made a little mistake, every two characters is one byte, not every
four characters. This would still cut the length in half.
 
Back
Top