SalStrCompress and SalStrUncompress info

Post your tools and samples or ask for them.
Dave Rabelink
Founder/Site Admin
Founder/Site Admin
Posts: 2956
Joined: 24 Feb 2017, 09:12
Location: Gouda, The Netherlands

SalStrCompress and SalStrUncompress info

Post by Dave Rabelink » 03 Dec 2020, 10:45

An article on TDWiki already discussed the detailed info on SalStrCompress and SalStrUncompress.

I have made some small changes to the article text and the sample which may be interesting to bump here.

The function SalStrCompress does NOT check if the data to be compressed is already compressed.
So as an example:

Code: Select all

Set sData = "This is just some text to compress"
Call SalStrCompress( sData )
Call SalStrCompress( sData )

! sData is now compressed twice. Having 2 compression headers in sequence

Call SalStrUncompress( sData )

! sData is not the original data now, it is still compressed. It has now 1 compression header

Call SalStrUncompress( sData )

! sData is now back to the original data

Using the custom function PALStrIsCompressed you can check whether data is compressed or not.

There are now two extra functions added to the sample:

PALStrCompressOnce -> will compress data only once. WHen data is already compressed it will not compress again.
PALStrUncompressAll-> will uncompress data having one or more compression headers until the data is uncompressed.

Here the TDWiki article link: ... ailed_info
Dave Rabelink

Articles and information on Team Developer Tips & Tricks Wiki
Download samples, documents and resources from TD Sample Vault
Videos on TDWiki YouTube Channel

Return to “Tools & Samples”

Who is online

Users browsing this forum: [Ccbot] and 0 guests