split_and_trim function

Split and trim a string