Function Co Decs Class

SqueezeString

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.

Signature (Visual Basic / VBA)

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

Code Example

    SqueezeString("This is a test.") = Chr$(244) + Chr$(200) + Chr$(142) + Chr$(234) + Chr$(159) + Chr$(243) + Chr$(240) + Chr$(46)
    SqueezeString("ZYXWVU") = "ZYXWVU"

Parameters

Parameter Description
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.

Notes & Version History

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.