Re: checking for upper case letter on string
| From: | Justin Patrin | Date: | Thu, 12 Aug 2004 21:47:07 +0000 |
| Subject: | Re: checking for upper case letter on string | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-193657@lists.php.net to get a copy of this message | ||
On Thu, 12 Aug 2004 15:32:33 -0600, C.F. Scheidecker Antunes
<nando@antunes.eti.br> wrote:
> Hello all,
>
> I need to check if there are any upper case letters on a given string.
> There can be one or more letters that might be upper case on a given
> string no matter their position within the string.
>
> Is there any way to check for it?
>
> obs: I do not want to convert to lowercase, but to check for the
> presence of upper case letters.
>
> I copuld iterate through the string and evaluate each caracter but I
> wonder if there is a more effective method to achieve that.
>
> examples:
>
> uyYmfawelk = returns true
> YlsngfswU = returns true
> kjnsdfW = true
> fwerg;m = false
>
if(preg_match('/[A-Z]/', $text)) {
echo 'Found caps!';
}
--
DB_DataObject_FormBuilder - The database at your fingertips
http://pear.php.net/package/DB_DataObject_FormBuilder
paperCrane --Justin Patrin--