User Tools

Site Tools


syntax:functions:compact

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Next revision
Previous revision
Last revisionBoth sides next revision
syntax:functions:compact [2016/06/07 23:35] – created dmitrysyntax:functions:compact [2021/08/01 18:02] craigt
Line 1: Line 1:
 ====== Compact(text) ====== ====== Compact(text) ======
 +Category:  Text function
  
-Removes repeating whitespace characters from //text//. +\\  
-Note that line breaks and other special characters are not counted as whitespace. +=====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.
  
- Example   Result  +\\  
-<code>compact( '          Z')</code>  |<code>'A Z'</code>+=====Arguments===== 
-| <code>len(compact( '          Z'))</code>  |  <code>3</code>+^Argument^Type^Description
-<code>compact( '            Z')</code>  |<code>'A N Z'</code> |+|text|Text|The text value to remove repeated spaces from.|
  
-=== See also === +**Return value type:** Text 
-  * [[syntax:functions:replace]] + 
-  * [[syntax:functions:trim]]+\\  
 +=====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 [[syntax:functions:trim|Trim(text)]] function. 
 + 
 + 
 +\\  
 +=====Examples===== 
 + 
 +  compact( '          Z') = 'A Z' 
 +  compact( '            Z') = 'A N Z' 
 +  len(compact( '          Z')) = 3 
 + 
 +\\  
 +===== See also ===== 
 +  * [[syntax:functions:trim|Trim(text)]] 
 +  * [[syntax:functions:replace|Replace(text, old_string, new_string)]]
syntax/functions/compact.txt · Last modified: 2021/08/14 21:58 by craigt

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki