Created
March 4, 2014 09:54
-
-
Save fschell/9343479 to your computer and use it in GitHub Desktop.
capitalize.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// capitalize string | |
String.prototype.cap = function(){ | |
return this.replace( /(^|\s)([a-z])/g , function(m,p1,p2){return p1+p2.toUpperCase();}); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment