Skip to content

isUpperCase ​

Checks if a string contains at least one uppercase letter and no lowercase letters.

Syntax ​

typescript
isUpperCase(str: string): boolean

Parameters ​

ParameterTypeDescription
strstringThe string to be checked.

Returns ​

TypeDescription
booleantrue if the string contains at least one uppercase letter and no lowercase letters, otherwise false.

Example ​

typescript
isUpperCase("ABC"); // true
isUpperCase("aBC"); // false
isUpperCase("123"); // false
isUpperCase(""); // false

Notes ​

  • Throws TypeError if the argument is not a string.
  • Spaces are ignored in the check.

References ​

Released under the MIT License.