Javascript String startsWith(s)
String.prototype.startsWith = function (s) { if (this.substr(0, s.length) === s) return true; else/*from ww w . j av a 2 s . co m*/ return false; }
/**//from www.j a va 2 s . co m * Test is a string starts with another * * @param {String} s string to test with * @type boolean */ String.prototype.startsWith = function (s) { return (this.indexOf(s) === 0); }