VB.Net string compression

APag96
APag96 used Ask the Experts™
on
Hello everyone!
I need a way to compress some numbers into a shorter string. Let me demonstrate...

original:
985410000000000000000135700005555555  

compressed:
985410(16)13570(4)5(7)

then I need to convert the compressed text back to the original. Also, I am going to be working with long numbers.
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
That seems like an awfully simplistic way to compress data. Do you have the luxury of using other techniques? If so, there's far more advanced compression built into the framework that would let you compress data without having to convert it to strings. Just do a search for "vb.net compression"

Author

Commented:
I just want to make a string as small as it can be. Then I want to get it back to its normal state. I AM open to other ways. Please share some. Thanks!
cool. there are countless examples of compression if you search for them.

first page of results has many. here's one. look for the code chunk down a page or two.

http://www.dreamincode.net/forums/showtopic89281.htm
Learn Ruby Fundamentals

This course will introduce you to Ruby, as well as teach you about classes, methods, variables, data structures, loops, enumerable methods, and finishing touches.

Author

Commented:
I'm not sure if I completely explained my question. I only want to make the string smaller in length. I am not compressing a file. Only plain text. Thanks for your quick replies!
Right, but if you look in that code example I sent, you'll see that it reads the file contents into memory, compresses it and writes it back out.

Author

Commented:
The page was loading SLOW. I thought it was done. I only read the first question, which was not what I wanted. Sorry.

Author

Commented:
I would not like to use any libraries or Active X things (GZip) to compress the string for me. I want to have FULL control over all of the compression. Thanks.
this is not active x. it's .net framework. did you read the article i sent? if you click on the link in it, you'll be brought directly to the msdn documentation for this built in library.

http://msdn.microsoft.com/en-us/library/system.io.compression.gzipstream.aspx

slow down. take a breath. read through everything and give it a few minutes to sink in. you don't have to reinvent the wheel here. it's all built into the framework.

Author

Commented:
I'm sorry.  I have always thought that gzip is not in the framework. I'm looking at the link...

Author

Commented:
I have looked at the link that you have provided me. I have also done some research. I have decided to use the "deflate" algorithm. Do you have any examples on how to compress\decompress a string with it? I have been looking.
Hello. I provided a link with serveral viable solutions pointed to a specific piece of code. Your last message indicated that you wished to change your request from "I need a way to compress" to "I have decided to use the "deflate" algorithm" after we had gone through quite a few exchanges.

I'd appreciate it if you'd mark this solution as answered, as I did take the time to research this for you and - as stated - did provide a perfectly viable solution.

Thank you.
As noted in my last comment, I provided a solution to this question. 50 points. Good grief.

Author

Commented:
I WAS going to award you the points after your first reply to the cancellation request. But you had to get mad about it in your second. Sorry dude. Thanks for your help though.
I was the sole expert on this question and answered it by forwarding an exact sampleof an in-memory string compression. I then pointed the author to MSDN documentation explaining the built-in support for compression, avoiding the need for a custom compression algorithm.

http://www.experts-exchange.com/Programming/Algorithms/Q_24577406.html?cid=1066#24881186
http://www.experts-exchange.com/Programming/Algorithms/Q_24577406.html?cid=1066#24881890

I tried to ask the author, before objecting but got no response for three days.

Thank you!

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial