摇曳的蔷薇
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))})