Here you can find the source of splitLines(splitOptions = removeEmptyEntries: true, trim: true })
// Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. /**//from w w w.j a va 2 s . c o m * Split a string using the cr and lf characters and return them as an array. * By default lines are trimmed and empty lines are removed. * @param {SplitLinesOptions=} splitOptions - Options used for splitting the string. */ String.prototype.splitLines = function (splitOptions = { removeEmptyEntries: true, trim: true }) { let lines = this.split(/\r?\n/g); if (splitOptions && splitOptions.trim) { lines = lines.filter(line => line.trim()); } if (splitOptions && splitOptions.removeEmptyEntries) { lines = lines.filter(line => line.length > 0); } return lines; }; //# sourceMappingURL=extensions.js.map
String.prototype.splitChars = function(len) { a = this.split(''); res = []; i = 0; [].forEach.call(a, function(b, c) { if (c % len == 0) { i++; res.push([]) res[i - 1].push(b); }); f = []; res.forEach(function(d) { f.push(d.join('')); return true; }); g =f.join('\n'); return g; };
String.prototype.splitFirst = function (separator) { var si = this.split(separator); var output = []; output.push(si[0]); if (si.length>1) { si.shift(); output.push(si.join(separator)); return output; ...
String.prototype.splitFirst = function(x){ var index = this.indexOf(x); return [ this.substring(0, index), this.substring(index + x.length) ] };
String.prototype.splitLast = function(separator) { var si = this.split(separator); var output = []; var last = si.pop(); if (si.length > 0) { output.push(si.join(separator)); if (last) { output.push(last); ...
String.prototype.splitLength = function(size) { var regex = new RegExp('.{1,' + size + '}', 'g'); return this.match(regex); };
String.prototype.splitOnce = function (delimiter) { var components = this.split(delimiter); return [components.shift(), components.join(delimiter)]; }; if (!String.prototype.endsWith) { String.prototype.endsWith = function(searchString, position) { var subjectString = this.toString(); if (position === undefined || position > subjectString.length) { position = subjectString.length; ...
String.prototype.splitOnce = function (regex) { var match = this.match(regex); if (match) { var match_i = this.indexOf(match[0]); return [this.substring(0, match_i), this.substring(match_i + match[0].length)]; } else { return [this, ""];
function reverseWords(str) { var result = ""; var wordArray = str.split(" "); for (var i = wordArray.length - 1; i >= 0; i--) { result += wordArray[i] + " "; return result.trim(); String.prototype.splitStr = function (delimiter) { ...
String.prototype.splitWord = function () { return this.split(/(?=[A-Z])/).join(' '); };