Function Co Decs Class

RunLengthDecode

Decode a string which was run length encoded (RLE) with a function like RunLengthEncode . Run length code strings are replaced by repeated runs of the specified character.

Signature (Visual Basic / VBA)

Public Function RunLengthDecode( _
      ByVal vValue As Variant _
    , Optional ByVal vRLEChar As Variant _
    ) As Variant

Code Example

    RunLengthDecode("ABBCCC" + Chr$(255) + Chr$(4) + "D" + Chr$(255) + Chr$(5) + "E") = "ABBCCCDDDDEEEEE"
    RunLengthDecode("This is a test.") = "This is a test."

Parameters

Parameter Description
vValue The run-length-encoded string that is to be decoded. Function returns Null if vValue is Null or cannot be fixed up to a String.
vRLEChar The character which introduces run-length codes within the string vValue. Note: Special argument fix-up code. If vRLEChar is a string, the ASCII value of the first character in the string is used as the run-length character. vRLEChar defaults to the character with ASCII value 255 if vRLEChar is an empty string. If vRLEChar is numeric, then the character with that ASCII value is used as the run-length character. vRLEChar defaults to the character with ASCII value 255 if vRLEChar is missing or Null or cannot be fixed up to either a string or number.

Notes & Version History

Note Run-length code strings are comprised of the run-length character, the character whose ASCII value is the repeat count, and the character being repeated.