Ruby String.capitalize for all words
So, I was trying to uppercase the first letter of all the words in a string. For example:
'the example string' -> 'The Example String'
So I had a look around and found this great little snippet of code:
Check out the original post here:
http://snippets.dzone.com/posts/show/4702
Laters,
J.
'the example string' -> 'The Example String'
So I had a look around and found this great little snippet of code:
'the example string'.gsub(/\b\w/){$&.upcase} Laters,
J.
