Function String Manipulations Class

CompressSpaces

Compresses all whitespace down to a single space character. Replaces all repeated runs of space-type characters (space, tab, carriage return, etc.) with a single space character. Uses the IsSpace function with the currently-loaded character classifications to determine which characters are considered "space".

Signature (Visual Basic / VBA)

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

Code Example

    CompressSpaces("Now  is" + vbCrLf + "the  time.  ") = "Now is the time. "

Parameters

Parameter Description
vValue The string from which repeated sequences of space-type characters are to be removed. Function return Null if vValue is Null or cannot be fixed up to a String.