Difference between revisions of "INFLATE$"

From QB64.org wiki
Jump to: navigation, search
Line 4: Line 4:
  
 
{{PageSyntax}}
 
{{PageSyntax}}
:{{Parameter|result$}} = [[_INFLATE$]]({{Parameter|stringToDecompress$}})
+
:{{Parameter|result$}} = [[_INFLATE$]]({{Parameter|stringToDecompress$[, originalSize&]}})
  
  
 
{{PageDescription}}
 
{{PageDescription}}
 
* {{Parameter|result$}} will contain the original version of {{Parameter|stringToDecompress$}}.
 
* {{Parameter|result$}} will contain the original version of {{Parameter|stringToDecompress$}}.
 +
* Optional parameter {{Parameter|originalSize&}} can be used if the original size of the uncompressed data is known beforehand, which makes the decompression routine run more efficiently.
  
  

Revision as of 23:21, 23 January 2020

The _INFLATE$ function decompresses a string compressed by the _DEFLATE$ function.


Syntax

result$ = _INFLATE$(stringToDecompress$[, originalSize&])


Description

  • result$ will contain the original version of stringToDecompress$.
  • Optional parameter originalSize& can be used if the original size of the uncompressed data is known beforehand, which makes the decompression routine run more efficiently.


Availability

  • Version 1.4 and up.


Examples

Example 1: Compressing a long string of text.

a$ = "The quick brown fox jumps over the lazy dog. " PRINT "Original string (a$): "; a$ FOR i = 1 TO 15 a$ = a$ + a$ NEXT PRINT "After concatenating it into itself several times, LEN(a$) ="; LEN(a$) b$ = _DEFLATE$(a$) PRINT "After using _DEFLATE$ to compress it, LEN ="; LEN(b$) PRINT USING "(compressed size is #.###% of the original)"; ((LEN(b$) * 100) / LEN(a$)) c$ = _INFLATE$(b$) PRINT "After using _INFLATE$ to decompress it, LEN ="; LEN(c$)

Original string (a$): The quick brown fox jumps over the lazy dog After concatenating it into itself several times, LEN(a$) = 1474560 After using _DEFLATE$ to compress it, LEN = 4335 (compressed size is 0.295% of the original) After using _INFLATE$ to decompress it, LEN = 1474560

See also



Navigation:
Go to Keyword Reference - Alphabetical
Go to Keyword Reference - By usage
Go to Main WIKI Page