text - VB.NET compress decompress string and return in string format -



text - VB.NET compress decompress string and return in string format -

i need vb.net function compressing/decompressing string, , homecoming result string. found these 2 functions:

//compress dim mem new io.memorystream dim gz new system.io.compression.gzipstream(mem, io.compression.compressionmode.compress) dim sw new io.streamwriter(gz) sw.writeline("hello compression") sw.close() //decompress dim mem2 new io.memorystream(mem.toarray) gz = new system.io.compression.gzipstream(mem2, io.compression.compressionmode.decompress) dim sr new io.streamreader(gz) msgbox(sr.readline) sr.close()

but how create them homecoming compressed string string? thanks.

you need base64 encode compressed byte array string representation.

dim compressed string = convert.tobase64string(mem.toarray())

the decompressed string can read streamreader.

dim decompressed string = sr.readline()

vb.net text compression

Comments

Popular posts from this blog

model view controller - MVC Rails Planning -

ruby on rails - Devise Logout Error in RoR -

html - Submenu setup with jquery and effect 'fold' -