add startsWith for string for browsers which don’t ship it yet. Fixes #45

This commit is contained in:
Stefan Breunig
2013-02-08 15:22:21 +01:00
parent 1c06623acb
commit fd15b5d4a4

View File

@ -141,3 +141,10 @@ window.zoomToAndShowPortal = function(guid, latlng) {
String.prototype.capitalize = function() {
return this.charAt(0).toUpperCase() + this.slice(1).toLowerCase();
}
// http://stackoverflow.com/a/646643/1684530 by Bergi and CMS
if (typeof String.prototype.startsWith !== 'function') {
String.prototype.startsWith = function (str){
return this.slice(0, str.length) === str;
};
}