Last active
May 18, 2016 13:59
-
-
Save rangercyh/6481804 to your computer and use it in GitHub Desktop.
my trim function to delete all the white char in string
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function my_trim(szText) | |
{ | |
var str = szText; | |
var cleanStr = ""; | |
whitespace = ' /n/r/t/f/x0b/xa0/u2000/u2001/u2002/u2003/u2004/u2005/u2006/u2007/u2008/u2009/u200a/u200b/u2028/u2029/u3000'; | |
for (var i = 0; i < str.length; ++i) | |
{ | |
if (whitespace.indexOf(str.charAt(i)) === -1) | |
{ | |
cleanStr += str.charAt(i); | |
} | |
} | |
return cleanStr; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment