|
@@ -0,0 +1,16 @@
|
|
|
+if (!String.prototype.endsWith) {
|
|
|
+ String.prototype.endsWith = function(searchString, position) {
|
|
|
+ var subjectString = this.toString();
|
|
|
+ if (position === undefined || position > subjectString.length) {
|
|
|
+ position = subjectString.length;
|
|
|
+ }
|
|
|
+ position -= searchString.length;
|
|
|
+ var lastIndex = subjectString.indexOf(searchString, position);
|
|
|
+ return lastIndex !== -1 && lastIndex === position;
|
|
|
+ };
|
|
|
+}
|
|
|
+
|
|
|
+String.prototype.splitOnce = function (delimiter) {
|
|
|
+ var components = this.split(delimiter);
|
|
|
+ return [components.shift(), components.join(delimiter)];
|
|
|
+};
|