INFLATE$: Difference between revisions
Jump to navigation
Jump to search
Navigation:
Main Page with Articles and Tutorials
Keyword Reference - Alphabetical
Keyword Reference - By usage
Report a broken link
No edit summary |
No edit summary Tag: Manual revert |
||
(6 intermediate revisions by 2 users not shown) | |||
Line 13: | Line 13: | ||
== | {{PageAvailability}} | ||
<!-- QB64 = a version or none, QBPE = a version or all, Platforms = yes or no --> | |||
<gallery widths="48px" heights="48px" mode="nolines"> | |||
File:Qb64.png|'''v1.4''' | |||
File:Qbpe.png|'''all''' | |||
File:Apix.png | |||
File:Win.png|'''yes''' | |||
File:Lnx.png|'''yes''' | |||
File:Osx.png|'''yes''' | |||
</gallery> | |||
<!-- additional availability notes go below here --> | |||
Line 25: | Line 34: | ||
a$ = a$ + a$ | a$ = a$ + a$ | ||
{{Cl|NEXT}} | {{Cl|NEXT}} | ||
{{Cl|PRINT}} "After concatenating it into itself several times, LEN(a$) ="; {{Cl|LEN}}(a$) | {{Cl|PRINT}} "After concatenating it into itself several times, LEN(a$) ="; {{Cl|LEN}}(a$) | ||
b$ = {{Cl|_DEFLATE$}}(a$) | b$ = {{Cl|_DEFLATE$}}(a$) | ||
{{Cl|PRINT}} "After using _DEFLATE$ to compress it, LEN ="; {{Cl|LEN}}(b$) | {{Cl|PRINT}} "After using _DEFLATE$ to compress it, LEN ="; {{Cl|LEN}}(b$) | ||
Line 41: | Line 50: | ||
After using _INFLATE$ to decompress it, LEN = 1474560 | After using _INFLATE$ to decompress it, LEN = 1474560 | ||
{{OutputEnd}} | {{OutputEnd}} | ||
{{PageSeeAlso}} | {{PageSeeAlso}} | ||
* [[_DEFLATE$]] | * [[_DEFLATE$]] | ||
* [[_BASE64DECODE$]], [[_BASE64ENCODE$]] | |||
{{PageNavigation}} | {{PageNavigation}} |
Latest revision as of 18:47, 30 January 2025
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.
- If unspecified, decompression still works as expected, but may use more steps and need to allocate more memory internally.
Availability
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