Split string and trim every element
<p>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 elements?</p>

<p>For example, on splitting <code>"  A   B #  C#D# E  #  "</code> on <code>#</code> the desired output is <code>[A   B,C,D,E]</code></p>

<p>The closest I got is <code>str.split("\\s*#\\s*")</code> which gives <code>[  A   B, C, D, E]</code></p>
