Revision: 13246
Initial Code
Initial URL
Initial Description
Initial Title
Initial Tags
Initial Language
at April 15, 2009 22:01 by troynt
Initial Code
/** * Usage var you = 'hello you guys'.between('hello ',' guys'); * you = 'you'; */ String.prototype.between = function(prefix, suffix) { s = this; var i = s.indexOf(prefix); if (i >= 0) { s = s.substring(i + prefix.length); } else { return ''; } if (suffix) { i = s.indexOf(suffix); if (i >= 0) { s = s.substring(0, i); } else { return ''; } } return s; }
Initial URL
http://userscripts.org/scripts/review/35396
Initial Description
Initial Title
Get String between a Prefix String and a Suffix String
Initial Tags
Initial Language
JavaScript