Reputation: 14088
Hi I need test javascript string for any lower latters i have build next code:
var LOWER = /[a-z]/;
var lower = LOWER.test('mystring');
but If string contain any special chars from other languages this code not working. and is is logical my test is just for English latter. How to write test for any language ?
Upvotes: 2
Views: 183
Reputation: 20928
You can do this:
function isLowerCase(s){
return s==s.toLowerCase()
}
isLowerCase('mystring');
toLowerCase
respects the unicode standard.
Some examples:
isLowerCase('ä')==true
isLowerCase('Ä')==false
Upvotes: 7