remove whitespaces from document fields

Hi,
I am converting a fixed length flat file to doc. Due to this many fields have white spaces. Is there any java service to remove these white spaces or should I use trim for all the fields?

If you are using pub.flatFile:convertToValues service then use the flag trimwhitespace in the input.

Thank you, but I am working on SAG 9.9 designer and there is a skipWhiteSpace option, but this not doing the desired job, as now my flat file is failing against schema validation.
Since this is a fixed length flat file, fields which do not have any values, have spaces instead.
For eg. : Even the field of length 25, and has only 2 char input will have value as
string1="25 "

flags/trimWhitespace is the input you want to set, not skipWhiteSpace.

A big Thank You to both of you for the help.