<script>
String.prototype.compare = function(str)
{
//不区分大小写
if(this.toLowerCase() == str.toLowerCase())
{
return "1"; // 正确
}
else{
return "0"; // 错误
}
}
alert("ABCDefg".compare("abcdEFG"));
alert("abc".compare("acd"));
</script>
js 判断两字符串是否相等, 不区分大小写
最新推荐文章于 2024-02-27 12:30:00 发布