Converts strings like 'activity_stream' to 'Activity Stream' - Node.js String

Node.js examples for String:Convert

Description

Converts strings like 'activity_stream' to 'Activity Stream'

Demo Code

  String.prototype.formatSymbolForDisplay = function() {
    // summary://  ww  w . ja v a  2s .  c om
    //     Converts strings like 'activity_stream' to 'Activity Stream'
    return this.replace(/_([a-z])/g, function(match, letter) { return " " + letter.toUpperCase(); }).capitalize();
  };

Related Tutorials