Nodejs Utililty Methods String Format

List of utility methods to do String Format

Description

The list of methods to do String Format are organized into topic(s).

Method

format()
String.prototype.format = function(){
  var args = arguments;
  return this.replace(/{(\d+)}/g, function(match, number){
    return typeof args[number] != 'undefined'
    ?args[number]
    :match;
  })
function getUrlParam(name){
...
format()
'use strict';
String.prototype.format = function () {
    var formatted = this,
        i;
    for (i = 0; i < arguments.length; i += 1) {
        formatted = formatted.replace("{" + i + "}", arguments[i]);
    return formatted;
};
...
format()
String.prototype.format = function(){
  var ret = this.toString();
  for (var i = 0; i < arguments.length; i++) {
    ret = ret.replace("%s", arguments[i]);
  return ret;
};
format()
String.prototype.format = function() {
    var newString = this;
    counter = 0;
    while (counter < arguments.length && newString.indexOf('{}') != -1) {
        newString = newString.replace('{}', arguments[counter++]);
    matches = newString.match(/{[0-9]+}/g);
    if (matches != null) {
        for (var i = 0; i < matches.length; i++) {
...
format()
String.prototype.format = function () {
    var txt = this;
    for (var i = 0; i < arguments.length; i++) {
        var exp = new RegExp('\\{' + (i) + '\\}', 'gm');
        txt = txt.replace(exp, arguments[i]);
    return txt;
};
if (!String.format) {
...
format()
function clearStorage() {
  localStorage.clear();
  setIcon();
function setIcon() {
String.prototype.format = function() {
  var formatted = this;
  for (var i = 0; i < arguments.length; i++) {
...
format()
String.prototype.format = String.prototype.f = function () {
    var s = this,
        i = arguments.length;
    while (i--) {
        s = s.replace(new RegExp('\\{' + i + '\\}', 'gm'), arguments[i]);
    return s;
};
format()
String.prototype.format = function() 
  var result = this;
  for (var ix = 0; ix < arguments.length; ix++) 
    var tagRegExp = new RegExp("\\{" + ix + "\\}", "gi");
    result = result.replace(tagRegExp, arguments[ix]);
  return result;
...
format()
String.prototype.format = function () {
    var formatted = this;
    for (var i = 0; i < arguments.length; i++) {
        var regexp = new RegExp('\\{' + i + '\\}', 'gi');
        formatted = formatted.replace(regexp, arguments[i]);
    return formatted;
};
function isNullOrWhitespace(input) {
...
format()
String.prototype.format= function(){
       var args = arguments;
       return this.replace(/\{(\d+)\}/g,function(s,i){
         return args[i];
       });