Page 1 of 1

Capitalize Each First Letter?

Posted: Tue Aug 08, 2006 7:52 pm
by toasty2
How can I capitalize each first letter of a word in a string? I think I saw something that would do this, but have forgotten since.

Posted: Tue Aug 08, 2006 7:53 pm
by Luke

Code: Select all

ucwords()

Posted: Tue Aug 08, 2006 7:56 pm
by RobertGonzalez
You go Ninja, you sour cream hat wearing horned baby tool user you.

Ninja in his new hat :arrow: Image or was it this one :arrow: Image. I can't tell with all that ice cream on his head.

Posted: Tue Aug 08, 2006 7:56 pm
by Luke
Everah wrote:You go Ninja, you sour cream hat wearing horned baby tool user you.

Ninja in his new hat :arrow: Image or was it this one :arrow: Image. I can't tell with all that ice cream on his head.
:D :lol: That's fantastic.

Posted: Tue Aug 08, 2006 8:00 pm
by RobertGonzalez
Thanks dude. I am still laughing at it. I must be tired because I am really laughing at it...

Image Image Image

Posted: Tue Aug 08, 2006 8:14 pm
by toasty2
Thanks, cool avatar too :wink:

Posted: Tue Aug 08, 2006 8:33 pm
by toasty2
It's helpful, but it only capitalizes the first word. :?

Posted: Tue Aug 08, 2006 8:37 pm
by Luke
no, ucfirst() does that...
The Manual wrote:ucwords -- Uppercase the first character of each word in a string

Posted: Tue Aug 08, 2006 10:58 pm
by toasty2
I just realized the problem, and I was using the correct function. I have underscores in my string instead of spaces, so it sees it all as one word, but I didn't think about it because I display the string as a link (the underscores just look like the rest of the link). I got it fixed now. Thanks anyway :D