Another way to do it is to use Damian Conway's Text::Autoformat module.
It's smart enough to handle multiple modes of case conversions. For
instance:
The 'title' mode capitalizes the first letter of every word in a
sentence: "Hello World. Goodbye. What A Cruel World"
The 'highlight' mode capitalizes only significant words: "Hello World.
Goodbye. What a Cruel World"
Options are:
$formatted = autoformat $rawtext, { case => 'lower' };
$formatted = autoformat $rawtext, { case => 'upper' };
$formatted = autoformat $rawtext, { case => 'sentence' };
$formatted = autoformat $rawtext, { case => 'title' };
$formatted = autoformat $rawtext, { case => 'highlight' };
Where would we be without Damian?
> -----Original Message-----
> From: Salvador Lopez [mailto:[EMAIL PROTECTED]]
> Sent: 27 July 2001 05:15
> To: [EMAIL PROTECTED]
> Subject: regular expressions
>
>
> Hello All,
>
> how can i convert only the first letter of each word
> in a string without changing any other characters?
> Is this a job for regular expressions?
>
> For example, convert:
>
> FROM: "hello world. goodbye cruel world"
>
> TO: "Hello World. Goodbye Cruel World"
>
> any help is appreciated.
>
> --sal
>
>
> __________________________________________________
> Do You Yahoo!?
> Make international calls for as low as $.04/minute with Yahoo!
> Messenger
> http://phonecard.yahoo.com/
>
> --
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
> --
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
_______________________________________________________
The American Occupational Therapy Foundation (AOTF)
Creating Opportunities through Research and Education
http://www.aotf.org
301.652.2682
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]