Extended splitting with option to trim whitespace from items