MySQL Forums
Forum List  »  Stored Procedures

Re: Capitalize each word in a string ?
Posted by: Jason R
Date: August 24, 2008 07:50AM

Guys...there is an easier way...

This seems to work ok

select CONCAT(UPPER(SUBSTRING(mystring,1,1)),LOWER(SUBSTRING(mystring,2))) as mystring;

example:

select CONCAT(UPPER(SUBSTRING("hELLO",1,1)),LOWER(SUBSTRING("hELLO",2)));

+----------+
| mystring |
+----------+
| Hello |
+----------+
1 row in set (0.00 sec)

Options: ReplyQuote


Subject
Views
Written By
Posted
Re: Capitalize each word in a string ?
6127
August 24, 2008 07:50AM
5517
September 15, 2008 01:33PM
7089
November 11, 2008 07:11AM
4999
August 24, 2008 07:52AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.