This commit is contained in:
barisusakli
2015-03-20 19:36:18 -04:00
parent 4c31535c4b
commit 810d3be512
3 changed files with 88 additions and 33 deletions

View File

@@ -365,6 +365,18 @@
}
return i < 0;
};
String.prototype.endsWith = function(suffix) {
if (this.length < suffix.length) {
return false;
}
var len = this.length;
var suffixLen = suffix.length;
for (var i=1; (i <= suffixLen && this[len - i] === suffix[suffixLen - i]); ++i) {
continue;
}
return i > suffixLen;
};
}
if ('undefined' !== typeof window) {