Difference between revisions of "TextTrim"
(2 intermediate revisions by 2 users not shown) | |||
Line 2: | Line 2: | ||
[[Category:Doc Status D]] <!-- For Lumina use, do not change --> | [[Category:Doc Status D]] <!-- For Lumina use, do not change --> | ||
− | = TextTrim(text'',leftOnly,rightOnly,trimChars'') = | + | == TextTrim(text'', leftOnly, rightOnly, trimChars'') == |
+ | Removes leading and trailing spaces from the text. When only one parameter is specified, leading and trailing space, tab, CR and LF characters are removed. When either optional «leftOnly» or «rightOnly» parameter is specified as <code>True</code>, the text is trimmed on one side only. You can also control which characters are trimmed using the optional «trimChars» parameter. | ||
− | + | == Examples == | |
+ | :<code>TextTrim(" Hello world ") → "Hello World"</code> | ||
+ | :<code>TextTrim(" Hello world ", leftOnly: True) → "Hello world "</code> | ||
+ | :<code>TextTrim(" Hello world ", rightOnly: True) → " Hello world"</code> | ||
+ | :<code>TextTrim(" [One, Two, Three] ", trimChars:" []") → "One, Two, Three"</code> | ||
− | + | The one-parameter form of the function is equivalent to: | |
+ | :<code>TextTrim(text, leftOnly: false, rightOnly: false, trimChars:" "&Chr(9)&Chr(10)&Chr(13))</code> | ||
− | = | + | ==History== |
− | + | This function is only available in Analytica 4.1 or later. | |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
+ | == See also == | ||
* [[Chr]] | * [[Chr]] | ||
* [[FindInText]] | * [[FindInText]] | ||
* [[SelectText]] | * [[SelectText]] | ||
+ | * [[Text functions]] |
Latest revision as of 21:58, 28 January 2016
TextTrim(text, leftOnly, rightOnly, trimChars)
Removes leading and trailing spaces from the text. When only one parameter is specified, leading and trailing space, tab, CR and LF characters are removed. When either optional «leftOnly» or «rightOnly» parameter is specified as True
, the text is trimmed on one side only. You can also control which characters are trimmed using the optional «trimChars» parameter.
Examples
TextTrim(" Hello world ") → "Hello World"
TextTrim(" Hello world ", leftOnly: True) → "Hello world "
TextTrim(" Hello world ", rightOnly: True) → " Hello world"
TextTrim(" [One, Two, Three] ", trimChars:" []") → "One, Two, Three"
The one-parameter form of the function is equivalent to:
TextTrim(text, leftOnly: false, rightOnly: false, trimChars:" "&Chr(9)&Chr(10)&Chr(13))
History
This function is only available in Analytica 4.1 or later.
See also
Comments
Enable comment auto-refresher