Is there any library API or regex pattern to split a String on some delimiter and automatically trim leading and trailing spaces from every element without having to loop the el
Without regex it should look like this:
" A B # C#D# E # " .split('#') .map(function(item) { return item.trim(); } ) .filter(function(n){ return n != "" });
outputs: ["A B", "C", "D", "E"]