标题: 网站增加大小写转换工具
时间: 2021-10-12发布,2021-10-15修改
function toFirstLetterCase() {
var index;
var tmpStr;
var tmpChar;
var preString;
var postString;
var strLen;
tmpStr = textBox.value.toLowerCase();
strLen = tmpStr.length;
if (strLen > 0) {
for (index = 0; index < strLen; index++) {
if (index == 0) {
tmpChar = tmpStr.substring(0, 1).toUpperCase();
postString = tmpStr.substring(1, strLen);
tmpStr = tmpChar + postString;
}
else {
tmpChar = tmpStr.substring(index, index + 1);
if (tmpChar == " " && index < (strLen - 1)) {
tmpChar = tmpStr.substring(index + 1, index + 2).toUpperCase();
preString = tmpStr.substring(0, index + 1);
postString = tmpStr.substring(index + 2, strLen);
tmpStr = preString + tmpChar + postString;
}
}
}
}
return = tmpStr;
}
『回复列表(9|隐藏机器人聊天)』