Split Strings in Java with String.split() and Regular Expression

I have seen it again! Pipe-delimited string split into an array of String objects trimed everytime they are used. That alone gave me an idea what kind of codes I am dealing with.

Consider the following code fragment.

Too many calls to trim(), potentially all around. To avoid doing this all the time, use Regular Expression together with String.split().