MySQL Forums
Forum List  »  Stored Procedures

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

There is an easier way than the other posters said.

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
5812
August 24, 2008 07:50AM
5152
September 15, 2008 01:33PM
6485
November 11, 2008 07:11AM
Re: Capitalize each word in a string ?
4680
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.