Software Development

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 trimmed every time they are used. That alone gave me an idea of 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().

You Might Also Like