Actually this is going to be pretty confusing.. why not remove \n \r \t like similar function in any other language do?

otherwise you need to note this only removes whitespace, no "\n\t" etc are touched.