// 下划线转换驼峰
function toHump(name) {
    return name.replace(/\_(\w)/g, function(all, letter){
        return letter.toUpperCase();
    });
}
// 驼峰转换下划线
function toLine(name) {
  return name.replace(/([A-Z])/g,"_$1").toLowerCase();
}


// 测试
let a = 'a_b2_345_c2345';
console.log(toHump(a));

let b = 'aBdaNf';
console.log(toLine(b));

  

相关文章:

  • 2022-12-23
  • 2021-08-25
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-09-27
  • 2022-01-19
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-01-16
  • 2022-12-23
  • 2021-07-22
  • 2021-06-26
  • 2022-02-09
相关资源
相似解决方案