Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

js string check case

//Some characters like numbers or punctuation also return true 
//when checked for lowercase/uppercase.
//The solve is the second part
//I found this to work very well for it:
function isLowerCase(str)
{
    return str == str.toLowerCase() && str != str.toUpperCase();
}
console.log(isLowerCase("a")); //expected true
console.log(isLowerCase("A")); //expected false
console.log(isLowerCase("Ü")); //expected false
console.log(isLowerCase("4")); //expected false
console.log(isLowerCase("_")); //expected false
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #js #string #check #case
ADD COMMENT
Topic
Name
9+6 =