note 56940 deleted from function.strtoupper by nlopess
| From: | nlopess@php.net | Date: | Sun, 20 May 2007 13:40:54 +0000 |
| Subject: | note 56940 deleted from function.strtoupper by nlopess | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-126724@lists.php.net to get a copy of this message | ||
Note Submitter: Sean
----
A quick, easy way to see if there are any caps; AND tell how many there are... you could easily do
this:
<?
$str="3 CAPS and the rest lowercase";
$howmany=preg_match_all("@[A-Z]@",$str,$m,PREG_OFFSET_CAPTURE);
?>
That would make $howmany become the integer 4; because there are 4 capitals in the string: $str.
("CAPS")
Hope this helps anyone.
~Sean