TrimWhitespace()

clean white space of the given string

TrimWhitespace( input=string );

Returns: String

Argument Description
input
string, required

string to clean up.

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">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">&quot;string length&quot;</span><span class="p">);</span>

See also