|
Posted by Leif Gregory on 02/23/05 20:31
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
Navigation:
[Reply to this message]
|