Page 1 of 1
Capitalize text function
Posted: Fri Sep 07, 2007 6:31 am
by josamoto
I'm looking for a function to capitalize text, so for example if someone has entered a string in ALL CAPS, I want the PHP function to convert it to proper written English syntax, i.e. Sentences start with a capital letter etc.
Any suggestions?
Posted: Fri Sep 07, 2007 6:37 am
by Charles256
http://www.php.net/manual/en/ref.strings.php read that page. Should be plenty of useful functions.
Posted: Fri Sep 07, 2007 6:45 am
by CoderGoblin
strtoupper should do what you need.
Posted: Fri Sep 07, 2007 12:21 pm
by feyd
CoderGoblin wrote:strtoupper should do what you need.
I believe ~josamoto is looking to make sure it's not in all caps.
ucwords() and
ucfirst() may be of interest, however they will not handle proper names well.
Posted: Mon Sep 10, 2007 2:44 am
by josamoto
Thanks guys! Your replies have been most useful! Much appreciated.
