Add trip function for remove whitespace in the final and the begin