System.ZLib.ZCompressStr

From RAD Studio API Documentation
Jump to: navigation, search

Delphi

function ZCompressStr(const s: string; level: TZCompressionLevel): TBytes;
function ZCompressStr(const s: string; level: TCompressionLevel): TBytes;

C++

extern DELPHI_PACKAGE System::DynamicArray<System::Byte> __fastcall ZCompressStr(const System::UnicodeString s, TZCompressionLevel level = (TZCompressionLevel)(0x2))/* overload */;

Properties

Type Visibility Source Unit Parent
function public
System.ZLib.pas
System.ZLib.hpp
System.ZLib System.ZLib

Description

ZCompressStr returns the compression of a string.

ZCompressStr will return the compressed version of a string specified by s as a pointer to a dynamic array of bytes (TBytes).

The level optional parameter represents the level of compression. ZCompressStr can be called without the level parameter. In this case, level is set to the default value: zcDefault. ZCompressStr may raise an EZCompressionError.

See sample:

function myCompress(mySource: string ): TBytes;
var
  compressedString: TBytes;
begin
  compressedString:= ZCompressStr(mySource);
  Result:= CompressedString;
end;

See Also