Last active
August 29, 2015 14:07
-
-
Save krizpoon/0b0800c35d7b86abafd8 to your computer and use it in GitHub Desktop.
Javascript String Utilities
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
String.prototype.getFileExtension = function() | |
{ | |
var ret = (/[.]/.exec(this)) ? /[^.]+$/.exec(this) : undefined; | |
if (ret && ret.length) ret = ret[0]; | |
return ret; | |
} | |
if (typeof String.prototype.startsWith != 'function') | |
{ | |
String.prototype.startsWith = function (str) | |
{ | |
return this.indexOf(str) === 0; | |
}; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment