trimText method finished

TODO: debug