Created
January 15, 2014 10:50
-
-
Save tracend/8434259 to your computer and use it in GitHub Desktop.
_.ucwords() #underscore #helper #cc
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
_.mixin({ | |
// Uppercase the first character of each word in a string | |
// From: http://phpjs.org/functions/ucwords/ | |
ucwords : function(str) { | |
return (str + '').replace(/^([a-z])|\s+([a-z])/g, function ($1) { | |
return $1.toUpperCase(); | |
}); | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment