Capitalize the first letter of both words in a two word string

Let’s say that I have a two word string and I want to capitalize both of them. name <- c(“zip code”, “state”, “final count”) The Hmisc package has a function capitalize which capitalized the first word, but I’m not sure how to get the second word capitalized. The help page for capitalize doesn’t suggest that … Read more

How can I capitalize the first letter of each word in a string using JavaScript?

I’m trying to write a function that capitalizes the first letter of every word in a string (converting the string to title case). For instance, when the input is “I’m a little tea pot”, I expect “I’m A Little Tea Pot” to be the output. However, the function returns “i’m a little tea pot”. This … Read more