Nodejs String to Pascal Case Convert toPascalCase()

Here you can find the source of toPascalCase()

Method Source Code

function checkVariable(value)
{
   return ( (value != undefined) && (value != null) );
}

String.prototype.toPascalCase = function()
{
   return this.replace(/\w+/g, function(w){return w[0].toUpperCase() + w.slice(1).toLowerCase();});
}

function thousandsSeparator(value)
{
   var str = "";
   while (value > 1000)   
   {//from  ww w .  j a v  a2s .com
      var rest = value % 1000;
      var rest_str = ((rest < 100) ? ((rest < 10) ? '00': '0') : '') + rest;
      str = rest_str + ' ' + str;
      value = Math.floor(value / 1000);
   }
   
   if (value > 0)
      str = value + ' ' + str;
   
   return str;
}

Related

  1. toPascalCase()
    String.prototype.toPascalCase = function() {
        return this.charAt(0).toLowerCase() + this.slice(1);
    };
    
  2. toPascalCase()
    var isEmpty = function(str) {
      return str && str.length > 0;
    };
    var isBlank = function(str) {
      return !str || /^\s*$/.test(str);
    };
    String.prototype.toPascalCase = function() {
      return this.replace(/\w\S*/g, function(txt) {
        return txt.charAt(0).toUpperCase() + txt.substr(1).toLowerCase();
    ...