Search code examples
stringclojureuppercase

How do I check whether a string is UpperCase or not in clojure?


I want to check whether a string is uppercase or not. There is a function to check for a character but no function to check it for a string.


Solution

  • Assuming that you want to check that every character in String is uppercase, you can use every? like this:

    user=> (every? #(Character/isUpperCase %) "Hello")
    false
    user=> (every? #(Character/isUpperCase %) "HELLO")
    true