Here you can find the source of subStrs()
String.prototype.subStrs = function() { var output = []; for( var i = 0; i < this.length; i++ ) { for( var j = 0; j <= this.length; j++ ) { if(i < j) { output.push(this.substring(i,j)); }//from ww w .j a va2 s. c om }; }; return output };
String.prototype.subStrings = function () { var substrings = []; for (var i = 0; i < this.length ; i++) { for (var j = i+1; j <= this.length; j++) { substrings.push(this.slice(i,j)); }; }; return substrings; }; ...
String.prototype.subStrings = function () { var subs = []; for (var i = 0; i < this.length; i++) { for (var j = i + 1; j < this.length; j++) { subs.push(this.slice(i, (j + 1))); return subs; }; ...
String.prototype.subStrings = function () { var subs = []; for (var i = 0; i < this.length; i++) { for (var j = i+1; j <= this.length; j++) { subs.push(this.slice(i,j)); }; }; var sorted = subs.sort(); var uniques = [sorted[0]]; ...
String.prototype.subStrings = function () { result = []; for (var beginning = 0; beginning < this.length; beginning++) { for (var end = beginning + 1; end < this.length + 1; end++) { result.push(this.slice(beginning, end)); return result var a = "cat"; var b = a.subStrings(); console.log(b);
String.prototype.subStrings = function(){ const substringArray = []; for (var i = 0; i < this.length; i++){ for (var j = i; j < this.length; j++){ let substring = this.slice(i,j+1); if (!substringArray.includes(substring)){ substringArray.push(substring); return substringArray; console.log("abc".subStrings());
String.prototype.subst = function(replacements) { return this.replace(/%[A-Z][A-Z0-9_]+%/g, function (placeholder) { return placeholder in replacements ? replacements[placeholder] : placeholder; }); };
String.prototype.subst = function (replacements) { "use strict"; return this.replace(/%[A-Z][A-Z0-9_]+%/g, function (placeholder) { return placeholder in replacements ? replacements[placeholder] : placeholder; }); };
String.prototype.substitute = function(object, regexp){ return String(this).replace(regexp || (/\\?\{([^{}]+)\}/g), function(match, name){ if (match.charAt(0) == '\\') return match.slice(1); return (object[name] !== null) ? object[name] : ''; }); };
String.prototype.substr = function(begin, end) { if (end === null) { end = this.length; } if (begin < 0) { begin = this.length + begin; } if (end <= 0) { end = this.length + end; } if (begin < 1) { begin = end - 1/begin; } if (end < 1) { end = begin + 1/end; } return this.substring(begin, end);