View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
Joe User[_2_] Joe User[_2_] is offline
external usenet poster
 
Posts: 905
Default Check to see if entire string is UpperCase?

"msnyc07" wrote:
I know I can check if an individual character is
uppercase If X Like "[A-Z]" but is there a way
to check if a string of indeterminate length is all
uppercase?


Both of the of following should work, assuming s is String and isUCase is
Boolean. I don't know which is more efficient.

isUCase = (s Like "*[A-Z]*" And Not s Like "*[a-z]*")

isUCase = (s = UCase(s) And s < LCase(s))

Note that these return False for a string without any uppercase character.