note 74441 added to function.preg-replace

From: Date: Wed, 11 Apr 2007 16:32:36 +0000
Subject: note 74441 added to function.preg-replace
Groups: php.notes 
Request: Send a blank email to php-notes+get-125300@lists.php.net to get a copy of this message
- Make the first letter of a sentence capital and the rest small, old trick with less code...not sure it's safe though. - It will search for the first alphabetic letter, even if the sentence doesn't start with one. <?php #usage $mySentence = sentalize($mySentence ); function sentalize($str){ return preg_replace('/([a-z])(.*)$/ie', "strtoupper('\\1').strtolower('\\2')",$str); } ?> ---- Server IP: 69.147.83.197 Probable Submitter: 217.54.2.132 ---- Manual Page -- http://www.php.net/manual/en/function.preg-replace.php Edit -- https://master.php.net/note/edit/74441 Del: integrated -- https://master.php.net/note/delete/74441/integrated Del: useless -- https://master.php.net/note/delete/74441/useless Del: bad code -- https://master.php.net/note/delete/74441/bad+code Del: spam -- https://master.php.net/note/delete/74441/spam Del: non-english -- https://master.php.net/note/delete/74441/non-english Del: in docs -- https://master.php.net/note/delete/74441/in+docs Del: other reasons-- https://master.php.net/note/delete/74441 Reject -- https://master.php.net/note/reject/74441 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#125300) next »