DEFLATE$: 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
(Created page with "{{DISPLAYTITLE:_DEFLATE$}} The _DEFLATE$ function compresses a string. {{PageSyntax}} :{{Parameter|result$}} = _DEFLATE$({{Parameter|stringToCompress$}}) {{PageDescription}} * {{Parameter|result$}} will contain the compressed version of {{Parameter|stringToCompress$}}. * To decompress the resulting string, use _INFLATE$. ==Availability== * '''Version 1.4 and up'''. {{PageExamples}} ''Example 1:'' Compressing a long string of text. {{CodeSta...") |
No edit summary |
||
Line 29: | Line 29: | ||
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$) | ||
{{Cl|PRINT | {{Cl|PRINT USING}} "(compressed size is #.###% of the original)"; (({{Cl|LEN}}(b$) * 100) / {{Cl|LEN}}(a$)) | ||
c$ = {{Cl|_INFLATE$}}(b$) | c$ = {{Cl|_INFLATE$}}(b$) | ||
PRINT "After using _INFLATE$ to decompress it, LEN ="; {{Cl|LEN}}(c$) | PRINT "After using _INFLATE$ to decompress it, LEN ="; {{Cl|LEN}}(c$) |
Revision as of 21:35, 21 October 2022
The _DEFLATE$ function compresses a string.
Syntax
- result$ = _DEFLATE$(stringToCompress$)
Description
- result$ will contain the compressed version of stringToCompress$.
- To decompress the resulting string, use _INFLATE$.
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