|
@@ -1,5 +1,5 @@
|
|
if (!String.prototype.endsWith) {
|
|
if (!String.prototype.endsWith) {
|
|
- String.prototype.endsWith = function(searchString, position) {
|
|
|
|
|
|
+ String.prototype.endsWith = function (searchString, position) {
|
|
var subjectString = this.toString();
|
|
var subjectString = this.toString();
|
|
if (position === undefined || position > subjectString.length) {
|
|
if (position === undefined || position > subjectString.length) {
|
|
position = subjectString.length;
|
|
position = subjectString.length;
|
|
@@ -10,10 +10,19 @@ if (!String.prototype.endsWith) {
|
|
};
|
|
};
|
|
}
|
|
}
|
|
|
|
|
|
-String.prototype.splitOnce = function (delimiter) {
|
|
|
|
- var components = this.split(delimiter);
|
|
|
|
- return [components.shift(), components.join(delimiter)];
|
|
|
|
-};
|
|
|
|
|
|
+if (!String.prototype.startsWith) {
|
|
|
|
+ String.prototype.startsWith = function (searchString, position) {
|
|
|
|
+ position = position || 0;
|
|
|
|
+ return this.substr(position, searchString.length) === searchString;
|
|
|
|
+ };
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+if (!String.prototype.splitOnce) {
|
|
|
|
+ String.prototype.splitOnce = function (delimiter) {
|
|
|
|
+ var components = this.split(delimiter);
|
|
|
|
+ return [components.shift(), components.join(delimiter)];
|
|
|
|
+ };
|
|
|
|
+}
|
|
|
|
|
|
if (!String.prototype.trim) {
|
|
if (!String.prototype.trim) {
|
|
String.prototype.trim = function () {
|
|
String.prototype.trim = function () {
|