Skip to content

Instantly share code, notes, and snippets.

@ratiw
Last active August 29, 2015 14:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ratiw/9c7b3ef02eb2a1f6f3a8 to your computer and use it in GitHub Desktop.
Save ratiw/9c7b3ef02eb2a1f6f3a8 to your computer and use it in GitHub Desktop.
javascript str_replace
function str_replace(search, replace, subject) {
var result = subject;
for (var i = 0; i < search.length; i++) {
result = result.replace(search[i], replace[i]);
}
return result;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment