-4

How to detect in Ruby if a sentence has all lower case letters? Likewise, how to detect if a sentence has all uppercase letters?

You can assume this is an English sentence with no foreign characters.

Simple question, I know. Please excuse brevity.

user2864740
  • 60,010
  • 15
  • 145
  • 220
Henley
  • 21,258
  • 32
  • 119
  • 207

1 Answers1

2

'string' == 'string'.downcase

If the string is equal to the string with all letters lowercased, then all letters are lowercased.

See here and here.

Community
  • 1
  • 1
evamvid
  • 831
  • 6
  • 18
  • 40