RE: Uppercase first letter of each new line?

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

 



> -----Original Message-----
> From: Robert Cummings [mailto:robert@xxxxxxxxxxxxx]
> Sent: Wednesday, February 27, 2008 5:09 PM
> To: Keikonium
> Cc: php-general@xxxxxxxxxxxxx
> Subject: Re:  Uppercase first letter of each new line?
> 
> 
> On Wed, 2008-02-27 at 16:38 -0500, Keikonium wrote:
> > Thank you again Robert, and thank you too Daniel. I have gotten both
> methods
> > to work flawlessly so far :). I am slowly learning by trial and error
> here,
> > but sometimes a little push in the right direction does some good ^_^.
> 
> Nothing against Dan, but you should use my version if this is coming
> from browser submitted data. Dan's presumes unix lines endings which
> won't always be the case.
> 
> Cheers,
> Rob.
> --
> .------------------------------------------------------------.
> | InterJinn Application Framework - http://www.interjinn.com |
> :------------------------------------------------------------:
> | An application and templating framework for PHP. Boasting  |
> | a powerful, scalable system for accessing system services  |
> | such as forms, properties, sessions, and caches. InterJinn |
> | also provides an extremely flexible architecture for       |
> | creating re-usable components quickly and easily.          |
> `------------------------------------------------------------'
> 
> --

Unless you only get line feeds ("\r"), this should work as well (for "\n" or
"\r\n" as line separators) 

$text = getTextFromSomewhereElse();
$newText = join("\n", array_map('ucfirst', explode("\n", $text)));

(fist thing that came to my mind, just posting because of that... use the regex
if you want to be safe)

Regards,

Rob(inet)


Andrés Robinet | Lead Developer | BESTPLACE CORPORATION 
5100 Bayview Drive 206, Royal Lauderdale Landings, Fort Lauderdale, FL 33308 |
TEL 954-607-4207 | FAX 954-337-2695 | 
Email: info@xxxxxxxxxxxxx  | MSN Chat: best@xxxxxxxxxxxxx  |  SKYPE: bestplace |
 Web: bestplace.biz  | Web: seo-diy.com

-- 
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