函数是这么定义的:String.prototype.toCase = function () {
var tmp = "";
for (var i = 0; i < this.length; i++) {
if (this.charCodeAt(i) > 0 && this.charCodeAt(i) < 255) {
tmp += String.fromCharCode(this.charCodeAt(i) + 65248);
} else {
tmp += String.fromCharCode(this.charCodeAt(i));
}
}
return tmp;
};输入字符串:"abcdefg"
输出:"a b c d e f g"
输入空格:" "
输出:""(这里显示不清楚,就是两个框框)
有谁知道这个函数一般是用来处理什么的,或者具体作用是什么呢?
var tmp = "";
for (var i = 0; i < this.length; i++) {
if (this.charCodeAt(i) > 0 && this.charCodeAt(i) < 255) {
tmp += String.fromCharCode(this.charCodeAt(i) + 65248);
} else {
tmp += String.fromCharCode(this.charCodeAt(i));
}
}
return tmp;
};输入字符串:"abcdefg"
输出:"a b c d e f g"
输入空格:" "
输出:""(这里显示不清楚,就是两个框框)
有谁知道这个函数一般是用来处理什么的,或者具体作用是什么呢?
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货