i having difficulty figuring out how remove unwanted characters.
below sample of array data. remove occurences of "rail national" or remove elements containing string "rail national".
if understand question correctly, remove element array contains text 'rail national' anywhere in it:
newarray = [ 'adult child class', 'ticket type', 'i rail national rail nation', 'rail nationa', 'rail national', 'route'] // remove items array .filter( function(i){ return !(findnocase( i, 'rail national' ) > 0); // edit items in array } ).map( function(i){ return replacenocase( i, 'il nati', '', 'all' ); } );
the filter function run closure against each item in array , return item in final array if closure returns true.
the map function return array each item potentially modified.
note, didn't cf engine you're using. sample code run on lucee server.
Comments
Post a Comment