扫码关注官方订阅号
JavaScript怎么判断一个字母小写大写?
闭关修行中......
/[A-Z]/.test("A") // true /[A-Z]/.test("b") // false
function IsUpper(code) { return code === code.toUpperCase() } console.log(IsUpper('a')) //false console.log(IsUpper('A')) //true
'a'.charCodeAt(0) > 96 //小写 'A'.charCodeAt(0) < 90 //大写
function isUpperCase(ch){ return ch >= 'A' && ch <= 'Z' } function isLowerCase(ch){ return ch >= 'a' && ch <= 'z' }
微信扫码关注PHP中文网服务号
QQ扫码加入技术交流群
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号
PHP学习
技术支持
返回顶部
闭关修行中......