<-- Previous || Up || Next -->

Squeeze String Function
Co Decs Class

Public Function SqueezeString( _
    ByVal vValue As Variant _
    ) As Variant

Compresses a string by replacing certain pairs of characters with a single character and by replacing certain infrequently-occurring characters with a two-character sequence.
This function achieves an average of 40% compression on English language text strings.

Examples:
    SqueezeString("This is a test.") = Chr$(244) + Chr$(200) + Chr$(142) + Chr$(234) + Chr$(159) + Chr$(243) + Chr$(240) + Chr$(46)
    SqueezeString("ZYXWVU") = "ZYXWVU"
See also:
    UnsqueezeString Function
    UnsqueezeStringLength Function
    CompressString Function
vValue: The string containing the text which is to be compressed. Function returns Null if vValue is Null or cannot be fixed up to a String.

Function returns an empty string if vValue is an empty string.

Note: The pairs of characters which are replaced by an individual character are those that appeared most frequently within a large sample of public English-language Internet documents.
Note: This function and the UnsqueezeString function both use the same character-pair definitions and they are the inverse of each other.

Copyright 1996-1999 Entisoft
Entisoft Tools is a trademark of Entisoft.