From c6f4b76e17be66f5a90d53ff07786d3ff062a58d Mon Sep 17 00:00:00 2001 From: jinzhencheng Date: Wed, 5 Oct 2016 09:50:44 +0800 Subject: [PATCH 1/2] 1.Add a new method,delete() 2.Updata the README.md --- README.md | 4 ++++ jstring.js | 19 +++++++++++++++++++ 2 files changed, 23 insertions(+) diff --git a/README.md b/README.md index 8f0dc73..1ae4299 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 Date: Wed, 5 Oct 2016 09:54:40 +0800 Subject: [PATCH 2/2] Modified README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 1ae4299..ac31e08 100644 --- a/README.md +++ b/README.md @@ -63,4 +63,4 @@ clear: will trim() + remove (+1) white-spaces in between ##### ( 11 ) String.delete() -'"xhello xworxld".delelte('x'); \\return "hello world" +`"xhello xworxld".delelte('x'); \\ return "hello world"`