Re: sentence case

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello Jay,

Wednesday, February 23, 2005, 11:05:51 AM, you wrote:
>> How can I convert sentences like this. To be upper and lower case.

J> http://www.php.net/ucfirst


That won't work because it'll only capitalize the first letter of the
string. Since his string contains more than one sentence he needs to
be able to capitalize the first letter of each sentence.

I'm thinking something like:

1. strtolower() the string
2. explode() on the period
3. Loop through the resulting array
   a. trim() whitespace on each element
   b. ucfirst() on each element of the array
   c. Concatenate the string back together, putting a period and a
      space at the end of each element.

That's the long way. Anyone know the shortcut! <grin>
   

-- 
Leif (TB lists moderator and fellow end user).

Using The Bat! 3.0.2.3 Rush under Windows XP 5.1
Build 2600 Service Pack 2 on a Pentium 4 2GHz with 512MB

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux