If you are using PHP, just use the ucwords function.

>From the PHP manual
ucwords(PHP 3>= 3.0.3, PHP 4 >= 4.0.0)

Uppercase the first character of each word in a string

string ucwords (string str)

Returns a string with the first character of each word in str capitalized,
if that character is alphabetic.

Example 1. ucwords() example

$foo = 'hello world!';

$foo = ucwords($foo); // Hello World!

$bar = 'HELLO WORLD!';

$bar = ucwords($bar); // HELLO WORLD!

$bar = ucwords(strtolower($bar)); // Hello World!

Note: The definition of a word is any string of characters that is
immediately after a whitespace

(These are: space, form-feed, newline, carriage return, horizontal tab, and
vertical tab).



I hope this helps.

Pat...

----- Original Message -----
From: "Peter Lovatt" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]>
Sent: Friday, April 26, 2002 8:24 AM
Subject: RE: Uppercase first letter of each word


> this is for php, if you are not using php then try something similar
>
> //use explode to create an array with one word in each item
> $sql_array = explode(" ", $sql_text)
>
> //loop thro the array
>
> while(list($val) = each($sql_array))
>     {
>         $val = ucfirst ($val);
>         $new_sql_text .= $val ;
>     }
>
> hth
>
> Peter
>
>
>
> -----------------------------------------------
> Excellence in internet and open source software
> -----------------------------------------------
> Sunmaia
> www.sunmaia.net
> [EMAIL PROTECTED]
> tel. 0121-242-1473
> -----------------------------------------------
>
> > -----Original Message-----
> > From: Doug Bishop [mailto:[EMAIL PROTECTED]]
> > Sent: 26 April 2002 05:10
> > To: [EMAIL PROTECTED]
> > Subject: RE: Uppercase first letter of each word
> >
> >
> > I have no problem with figuring out how to punctuate a field that
> > contains a
> > single word, but how would I code a SQL query to proper-case each
> > word in a
> > field when the field contains, for instance, a title? I want to convert,
> > "HOW NOW BROWN COW" to, "How Now Brown Cow"
> >
> > Thanks,
> > Doug
> >
> >
> > ---------------------------------------------------------------------
> > Before posting, please check:
> >    http://www.mysql.com/manual.php   (the manual)
> >    http://lists.mysql.com/           (the list archive)
> >
> > To request this thread, e-mail <[EMAIL PROTECTED]>
> > To unsubscribe, e-mail
> > <[EMAIL PROTECTED]>
> > Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php
> >
>
> ---------------------------------------------------------------------
> Before posting, please check:
>    http://www.mysql.com/manual.php   (the manual)
>    http://lists.mysql.com/           (the list archive)
>
> To request this thread, e-mail <[EMAIL PROTECTED]>
> To unsubscribe, e-mail
<[EMAIL PROTECTED]>
> Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php
>


---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

Reply via email to