Delphi Database, Delphi Components from ComponentAce
Products Download Order Contact us
/img/help/home.gif /img/help/prev.gif /img/help/next.gif

 

Compressing a string

 


 

With Easy Compression Library you can easily compress and decompress a string.

 

Compressing a string.

To compress a string you need to call ECLCompressAndEncryptString function.

As the string is not encrypted the Password parameter is to be blank.

This function adds an internal header to compressed data, so you'll see an effect of compression (decreasing length of the string) only on not very short strings.

 

Decompressing a string.

To decompress a string you need to call ECLDecompressAndDecryptString.

 

Example:

var

CompStr, DecompStr: string;

begin

{ compress a string }

ECLCompressAndEncryptString('test', CompStr, '', ppmFastest);

{ decompress a string }

ECLDecompressAndDecryptString(CompStr, DecompStr);

{ show decompressed string }

ShowMessage(DecompStr);

end;

 

 

Warning:

Set bHexFormat parameter of ECLCompressAndEncryptString to True if you plan to access the compressed string as null-terminated string (PChar).

By default compressed string can contain some CHR(0) entrances and accessing the string with PChar() will not be correct.

 

 

        © 2003 - 2017 ComponentAce  | .net zip component | barcode for .net | delphi zip component | delphi database Feb 20, 2017