diff --git a/README.md b/README.md index 8f0dc73..ac31e08 100644 --- a/README.md +++ b/README.md @@ -60,3 +60,7 @@ clear: will trim() + remove (+1) white-spaces in between ##### ( 10 ) String.insert() `"normal text".insert("X", 4); \\ return "normXal text"` + +##### ( 11 ) String.delete() + +`"xhello xworxld".delelte('x'); \\ return "hello world"` diff --git a/jstring.js b/jstring.js index c2a082b..ed8724f 100644 --- a/jstring.js +++ b/jstring.js @@ -62,3 +62,22 @@ String.prototype.insert = function(text,at) { return this.substring(0,at)+text+this.substring(at); } + +/* + * update 2016/10//04 + */ +//(11)String.delete() +String.prototype.delete=function(text){ + if(!this.contains(text)) + return this; + var ary=this.split(""); + for(var i=0;i