Sample source code and easy string compression and encoding with VB.NET
This article discusses string compression with optional proper encoding in pure VB.NET code without the need for external tools.
It can be easily integrated into existing projects. Since the code is kept simple, it is suitable for beginners and conversion to C# can be easily done.
In need of a routine to quickly and safely deflate and inflate large strings, I looked for a solution on the net. A comprehensive set of functions was not shown, so I decided to write this class module, which contains all the functions needed to complete the task.
Using the code
Although strings of any length can be applied to the process, compressing short strings (ie 'Hello World!') is counterproductive as it results in larger compressed counterparts. The CompressionRatio property of the class tells you how effective the compression was. You can then decide if you want to use the compressed string, and if so, the prefix and suffix can be automatically applied to it to later distinguish between compressed and uncompressed content.
Dear user, you are offered a download