Determine if string is all uppercase?

Determine if string is all uppercase?

am 30.09.2007 07:12:16 von Angela

Hello

Is there a simple way to determine if a string is all in uppercase
characters?


Thanks

Re: Determine if string is all uppercase?

am 30.09.2007 11:18:51 von FD

"Angela" schreef in bericht
news:QeGLi.34982$nO3.27264@edtnps90...
> Hello
>
> Is there a simple way to determine if a string is all in uppercase
> characters?
>
>
> Thanks

if ($string == strtoupper($string))
echo "It's all uppercase!";

Frank

Re: Determine if string is all uppercase?

am 30.09.2007 21:45:46 von Michael Fesser

..oO(Angela)

>Is there a simple way to determine if a string is all in uppercase
>characters?

ctype_upper()

Micha

Re: Determine if string is all uppercase?

am 01.10.2007 00:23:15 von Peter

>
> ctype_upper()

Just a note. That method only works if the string comprises only of letters
(will return false if a space or a number is in the string for example
regardless of whether all letters are uppercase)

Re: Determine if string is all uppercase?

am 01.10.2007 05:16:09 von Angela

peter wrote:
>> ctype_upper()
>
> Just a note. That method only works if the string comprises only of letters
> (will return false if a space or a number is in the string for example
> regardless of whether all letters are uppercase)
>
>

Thanks for the help, will try it out

Here are the string I am getting (users are submitting)
Wanting to determine if all words in the string are uppercase

"SELLING NOKIA N95 AT $270, NOKIA E90 COMMUNICATOR AT $300, 8GB APPLE
IPHONE"

"FOR SALE BRAND NEW APPLE IPHONE 8GB"

etc

Re: Determine if string is all uppercase?

am 01.10.2007 18:52:44 von Peter

> Thanks for the help, will try it out
>
> Here are the string I am getting (users are submitting)
> Wanting to determine if all words in the string are uppercase
>
> "SELLING NOKIA N95 AT $270, NOKIA E90 COMMUNICATOR AT $300, 8GB APPLE
> IPHONE"
>
> "FOR SALE BRAND NEW APPLE IPHONE 8GB"
>
> etc

That being the case then the solution FD posted would be best in my
opinion:-

if ($string == strtoupper($string))
{
echo 'is upper';
}