Skip to content

stringCase

Validates that a string is entirely uppercase or entirely lowercase.

Options

OptionTypeDefaultDescription
case"upper" | "lower"requiredThe required case
messagestringlocale defaultCustom error message

Playground

Valid values

ValueNotes
"HELLO"All uppercase (case=upper)
"hello"All lowercase (case=lower)

Invalid values

ValueReason
"hello"Lowercase when case: "upper"
"Hello"Mixed case

Notes

  • Empty string ("") always returns valid: true — validators only run on non-empty values. Combine with notEmpty to require a value.
  • Non-letter characters (digits, symbols) are ignored in the case check.

Released under the MIT License.