Propercase in javascript





5
Date Submitted Wed. Aug. 9th, 2006 4:36 AM
Revision 1 of 1
Syntax Master sundaramkumar
Tags JavaScript
Comments 0 comments
Proper case a string


String.prototype.toProperCase = function()
{
  return this.toLowerCase().replace(/^(.)|\s(.)/g, function($1) { return $1.toUpperCase(); });
}


 

Comments

There are currently no comments for this snippet.

Voting