Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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"`
19 changes: 19 additions & 0 deletions jstring.js
Original file line number Diff line number Diff line change
Expand Up @@ -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<ary.length;++i){
if(ary[i] == text){
ary.splice(i,1);
}
}
return ary.join("");
}