split into list, stripping whitespaces, and rejoin