User Tools

Site Tools


syntax:functions:compact

Differences

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

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
syntax:functions:compact [2018/08/15 08:35] dmitrysyntax:functions:compact [2021/08/14 21:58] (current) – [Examples] 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') //Returns 'A Z' 
 + 
 +  compact( '            Z') //Returns 'A N Z' 
 + 
 +  len(compact( '          Z')) //Returns 3 ('A' space 'Z'
 + 
 +\\  
 +===== See also ===== 
 +  * [[syntax:functions:trim|Trim(text)]] 
 +  * [[syntax:functions:replace|Replace(text, old_string, new_string)]]
syntax/functions/compact.1534336530.txt.gz · Last modified: 2018/08/15 08:35 by dmitry

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki