Add StripTrailingWhitespace function