User Tools

Site Tools


syntax:functions:compact

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

syntax/functions/compact.txt · Last modified: 2021/08/14 21:58 by craigt

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki