Skip to content

Instantly share code, notes, and snippets.

@hailinzeng
Created November 8, 2013 09:18
Show Gist options
  • Save hailinzeng/7368462 to your computer and use it in GitHub Desktop.
Save hailinzeng/7368462 to your computer and use it in GitHub Desktop.
replace hex string in url with char
// replace hex string in url with char, replace %2F with /
url = "http://www.58.com%2Fserver%2Fserver.xml";
url.replace(/%([0-9A-Fa-f]{2})/g, function() {
return String.fromCharCode(parseInt(arguments[1], 16));
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment