string.trimWhiteSpace()

clean white space of the given string

string.trimWhiteSpace( )

Returns: String

This function does not take any arguments.

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">&quot;Original string&quot;</span><span class="p">);</span>
<span class="nf">writeOutput</span><span class="p">(</span><span class="s2">&quot;Before Trim the Whitespace &lt;br /&gt;&quot;</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">&quot;string length&quot;</span><span class="p">);</span>
<span class="nf">writeOutput</span><span class="p">(</span><span class="s2">&quot;After Trim the Whitespace &lt;br /&gt;&quot;</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.trimWhitespace</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">&quot;string length&quot;</span><span class="p">);</span>

See also