Category: Text function
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.
Argument | Type | Description |
---|---|---|
text | Text | The text value to remove repeated spaces from. |
Return value type: Text
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.
compact( 'A Z') //Returns 'A Z'
compact( 'A N Z') //Returns 'A N Z'
len(compact( 'A Z')) //Returns 3 ('A' space 'Z')