imporved StripTrailingWhitespace function.

--HG--
extra : amend_source : 534bb63acd1ab34af9d6d01e3208ea9c30447c3c