VB.Net string compression

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



then I need to convert the compressed text back to the original. Also, I am going to be working with long numbers.
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"


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.

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.


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.


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


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.


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.


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


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.


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.


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