StringFilter()
Filters a string to its elements for which the callback function returns true.
Introduced: 6.0.0.105
StringFilter( string=string, closure=function );
Returns: String
Examples
letters = "abbcdB";
callbackFunction = function(input){return input=="b";}
<span class="nv">result</span> <span class="o">=</span> <span class="nf">stringFilter</span><span class="p">(</span><span class="nv">letters</span><span class="p">,</span><span class="nv">callbackFunction</span><span class="p">);</span>
<span class="nf">writeDump</span><span class="p">(</span><span class="nv">result</span><span class="p">);</span>
<span class="nv">result1</span> <span class="o">=</span> <span class="nf">stringFilter</span><span class="p">(</span><span class="s2">"bob"</span><span class="p">,</span><span class="nv">callbackFunction</span><span class="p">);</span>
<span class="nf">writeDump</span><span class="p">(</span><span class="nv">result1</span><span class="p">);</span>
See also
- string.filter()
- Search Issue Tracker
- Search Lucee Test Cases (good for further, detailed examples)