Table of Contents

Compact(text)

Category: Text function


Description

This function removes repeating whitespace from text, reducing it to a single space. Note that line breaks and other special characters are not counted as whitespace.


Arguments

ArgumentTypeDescription
textTextThe text value to remove repeated spaces from.

Return value type: Text


Remarks

There needs to be two or more repeated spaces in text for this function to have an effect. If text is a string with no spaces or only single spaces within the text no change to text will occur.

As this function reduces repeated spaces to a single space, it cannot be used to completely remove leading and trailing whitespace. For that, use the Trim(text) function.


Examples

compact( 'A           Z') //Returns 'A Z'
compact( 'A       N       Z') //Returns 'A N Z'
len(compact( 'A           Z')) //Returns 3 ('A' space 'Z')


See also