TrimWhitespace()
clean white space of the given string
TrimWhitespace( input=string );
Returns: String
Examples
res = " I love Lucee ";
<span class="nf">writeDump</span><span class="p">(</span><span class="k">var</span><span class="o">=</span><span class="nv">res</span><span class="p">,</span> <span class="nv">label</span><span class="o">=</span><span class="s2">"Original string"</span><span class="p">);</span>
<span class="nf">writeOutput</span><span class="p">(</span><span class="s2">"Before Trim the Whitespace <br />"</span><span class="p">);</span>
<span class="nf">writeDump</span><span class="p">(</span><span class="k">var</span><span class="o">=</span><span class="nf">res.len</span><span class="p">(),</span> <span class="nv">label</span><span class="o">=</span><span class="s2">"string length"</span><span class="p">);</span>
<span class="nf">writeOutput</span><span class="p">(</span><span class="s2">"After Trim the Whitespace <br />"</span><span class="p">);</span>
<span class="nf">writeDump</span><span class="p">(</span><span class="k">var</span><span class="o">=</span><span class="nf">TrimWhitespace</span><span class="p">(</span><span class="nv">res</span><span class="p">).</span><span class="k">len</span><span class="p">(),</span> <span class="nv">label</span><span class="o">=</span><span class="s2">"string length"</span><span class="p">);</span>
See also
- Strings
- LTrim()
- RTrim()
- Trim()
- string.trimWhiteSpace()
- Search Issue Tracker
- Search Lucee Test Cases (good for further, detailed examples)