Skip to content

Instantly share code, notes, and snippets.

@raspo
Created March 11, 2012 12:32
Show Gist options
  • Save raspo/2016265 to your computer and use it in GitHub Desktop.
Save raspo/2016265 to your computer and use it in GitHub Desktop.
Stripslahes function for javascript
function stripslashes( str ) {
return (str + '').replace(/\\(.?)/g, function (s, n1){
switch (n1) {
case '\\':
return '\\';
case '0':
return '\u0000';
case '':
return '';
default:
return n1;
}
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment