统计字符串中的大小写字母个数

  

剩余(100)个字符



       js:操作      
function func1(){
var x = document.getElementById("dome1").value;
var upCount = 0;
var lowCount = 0;
var otherCount = 0;
for (var i=0;i= 'a' && c <='z') {
lowCount++;
} else if(c >= 'A' && c <='Z'){
upCount++;
}else{
otherCount++;
}
}
var zifu =Number(x.length);
var da = 120 - zifu;
document.getElementById("dome2").innerHTML="剩余("+da+")个字符";
document.getElementById("dome").innerHTML="大写字母个数为:"+upCount+",小写字母个数为"+lowCount+",其他字符:"+otherCount;
}

你可能感兴趣的:(大写字母)