Skip to content

Instantly share code, notes, and snippets.

@KOBA789
Created August 28, 2010 04:48
Show Gist options
  • Save KOBA789/554734 to your computer and use it in GitHub Desktop.
Save KOBA789/554734 to your computer and use it in GitHub Desktop.
// 全置換:全ての文字列 org を dest に置き換える
String.prototype.replaceAll = function (org, dest){
  return this.split(org).join(dest);
}
var str = "なんとかかんとか"
str = str.replaceAll("とか", "だか");
console.log(str);
// > なんだかかんだか
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment