Add trimWhiteSpace and coerce methods

Including tests and documentation.