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?
Capitalize text function
Moderator: General Moderators
-
Charles256
- DevNet Resident
- Posts: 1375
- Joined: Fri Sep 16, 2005 9:06 pm
http://www.php.net/manual/en/ref.strings.php read that page. Should be plenty of useful functions.
- CoderGoblin
- DevNet Resident
- Posts: 1425
- Joined: Tue Mar 16, 2004 10:03 am
- Location: Aachen, Germany
strtoupper should do what you need.
- feyd
- Neighborhood Spidermoddy
- Posts: 31559
- Joined: Mon Mar 29, 2004 3:24 pm
- Location: Bothell, Washington, USA
I believe ~josamoto is looking to make sure it's not in all caps.CoderGoblin wrote:strtoupper should do what you need.
ucwords() and ucfirst() may be of interest, however they will not handle proper names well.