下划线分割的小写字符串 改写成 驼峰字符串 'abc_de' => 'abcDe' 俊采星驰 2023-12-25 26 阅读1分钟 问题:下划线分割的小写字符串 改写成 驼峰字符串 'abc_de' => 'abcDe' 答: function toCaml(str){ return str.replace(/_([a-zA-Z])/gi, function(match,group1){ return group1.toUpperCase(); }) } const str='abc_de_Fg'; const res=toCaml(str); console.log(res)