Skip to content

Instantly share code, notes, and snippets.

@dustinpoissant
Created December 1, 2017 17:38
Show Gist options
  • Save dustinpoissant/6f535d108a16c92f1431fdfd51a8ba16 to your computer and use it in GitHub Desktop.
Save dustinpoissant/6f535d108a16c92f1431fdfd51a8ba16 to your computer and use it in GitHub Desktop.

Revisions

  1. dustinpoissant created this gist Dec 1, 2017.
    7 changes: 7 additions & 0 deletions String.extract.func.js
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,7 @@
    String.prototype.extract = function(start, finish){
    var s = this.indexOf(start);
    if(s == -1) return "";
    var e = this.indexOf(finish, s + start.length);
    if(e == -1) return "";
    return this.substring(s + start.length, e);
    }
    1 change: 1 addition & 0 deletions String.extract.func.min.js
    Original file line number Diff line number Diff line change
    @@ -0,0 +1 @@
    String.prototype.extract=function(t,n){var r=this.indexOf(t);if(-1==r)return"";var i=this.indexOf(n,r+t.length);return-1==i?"":this.substring(r+t.length,i)};