remove trailing and leasing whitespace from result