用javascript来解决!!!求解!
1 回答
摇曳的蔷薇
TA贡献1793条经验 获得超6个赞
function test(str){
return str.replace(/\b[\w\']+\b/g,function(match){
return match.toLowerCase().replace(/^./,function(match){
return match.toUpperCase();
});
});
}
[
"I'm a little tea pot",
"sHoRt AnD sToUt",
"HERE IS MY HANDLE HERE IS MY SPOUT"
].forEach(function(str){
console.log(test(str))
})
添加回答
举报
0/150
提交
取消