Re: Capitalizing the first letter

From: Date: Tue, 13 Mar 2007 14:30:22 +0000
Subject: Re: Capitalizing the first letter
References: 1 2  Groups: php.general 
Request: Send a blank email to php-general+get-250428@lists.php.net to get a copy of this message
Hello Again, You can use ucwords() functions except my method. This function returns a string with the first character of each word in str capitalized, if that character is alphabetic. :) -- Haydar TUNA Republic Of Turkey - Ministry of National Education Education Technology Department Ankara / TURKEY Web: http://www.haydartuna.net > Hello, > In PHP ucfirst() function make a string's first character uppercase. > But ralph smith have two words respectivetely ralph and smith. For this > reason, if you call the ucfirst("ralph smith") function, you cannot see > the Ralph Smith. You see the Ralph smith. If you want to see Ralph Smith > string, you should use explode() function. With this functions, you > returns an array of strings, each of which is a substring of string formed > by splitting it on boundaries formed by the string delimiter.In the ralph > smith delimeter characeter is blank line. You can use like a following > examples in your code:) > > <?php > $yourname = "ralph smith"; > > $name = explode (" ", $yourname); > > $yournewname = ucfirst( $name[0] ) . " " . ucfirst ( $name[1] ); > > echo ( $yournewname ); > ?> > > -- > Haydar TUNA > Republic Of Turkey - Ministry of National Education > Education Technology Department Ankara / TURKEY > Web: http://www.haydartuna.net > > "Todd Cary" <todd@aristesoftware.com> wrote in message > news:B5.10.34414.CB0B6F54@pb1.pair.com... >>I would like to write a filter that takes the text "smith" or "SMith" and >>returns "Smith"; same for "ralph smith". Is the a good source on using >>filters this way? >> >> Thank you...

« previous php.general (#250428) next »