Re: Uppercase first letter of each new line?

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

 



On Wed, Feb 27, 2008 at 4:13 PM, Keikonium <Keikonium@xxxxxxxxxxx> wrote:
[snip!]
>  I was thinking something like splitting each new line into a separate
>  string, capitalizing the first letter with ucfirst(), and then merging the
>  string back together might work, but I am not sure how to find a new line.
[snip!]

    Here's a function to help you out.  It's also online here:
        [Demo]    http://www.pilotpig.net/code-library/capitalize-line.php
        [Source]
http://www.pilotpig.net/code-library/source.php?f=capitalize-line.php

function ucnewline($str) {
        $arr = explode("\n",$str);
        foreach($arr as $p) {
                $ret .= ucfirst($p)."\n";
        }
        return $ret;
}

-- 
</Dan>

Daniel P. Brown
Senior Unix Geek
<? while(1) { $me = $mind--; sleep(86400); } ?>

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