stringCase
Validates that a string is entirely uppercase or entirely lowercase.
Options
| Option | Type | Default | Description |
|---|---|---|---|
case | "upper" | "lower" | required | The required case |
message | string | locale default | Custom error message |
Playground
Valid values
| Value | Notes |
|---|---|
"HELLO" | All uppercase (case=upper) |
"hello" | All lowercase (case=lower) |
Invalid values
| Value | Reason |
|---|---|
"hello" | Lowercase when case: "upper" |
"Hello" | Mixed case |
Notes
- Empty string (
"") always returnsvalid: true— validators only run on non-empty values. Combine withnotEmptyto require a value. - Non-letter characters (digits, symbols) are ignored in the case check.