|
|
|
|
||||||
![]() |
|
|
LinkBack | Outils de la discussion |
|
|
#2 (permalink) |
|
Messages: n/a
Hébergeur: |
"Angela" <angela@adjingo.com> 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 |
|
|
|
#4 (permalink) |
|
Messages: n/a
Hébergeur: |
>
> 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) |
|
|
|
#5 (permalink) |
|
Messages: n/a
Hébergeur: |
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 , 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 |
|
|
|
#6 (permalink) |
|
Messages: n/a
Hébergeur: |
> Thanks for the , 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'; } |
|
![]() |
| Outils de la discussion | |
|
|