note 55885 deleted from function.strtoupper by nlopess
| From: | nlopess@php.net | Date: | Sun, 20 May 2007 13:41:24 +0000 |
| Subject: | note 55885 deleted from function.strtoupper by nlopess | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-126726@lists.php.net to get a copy of this message | ||
Note Submitter: Indio
----
Here is way to test a string for upper case characters (smaller footprint than previous post)
// test if a string or a single character in a string is uppercase
// if this returns false, then the "string" is lower case
function CheckCase($string,$location='-1') {
// if a location is passed in, check that character only.
// if not, or the passed in value is <0, check the whole
// string for uppercase characters.
if($location >= 0) {
return(strcmp(strtolower($string{$location}),$string{$location}));
}
else {
return(strcmp(strtolower($string),$string));
}
}