trim leading or trailing characters from string
BUGFIX: at least I think so; forgot what exactly I have done and am too lazy too look it up