<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title></title>
<h5>sql字段批量转小写驼峰实例:ABC_DEF -> abcDef</h5>
<textarea id="sql" style="width: 300px;" rows="10"></textarea>
<h5>结果</h5>
<textarea id="result" style="width: 300px;" rows="10"></textarea>
<button onclick="aa()">开始</button>
</head>
<body>
</body>
<script>
function aa() {
let str = document.getElementById("sql").value;
let list = str.replace(/[\r\n]/g);
list = list.replace(/\s+/ig, ",");
list = list.replace(" ", '')
let aa = []
let list2 = list.split(",")
list2.forEach(item => {
let list3 = item.split("_");
let str = "";
for (let i = 0; i < list3.length; i++) {
if (i == 0) {
str = list3[i].toLocaleLowerCase()
console.log(list3[i].toLocaleLowerCase())
} else {
for (let j = 0; j < list3[i].length; j++) {
if (j == 0) {
str += list3[i][j].toLocaleUpperCase()
} else {
console.log(list3[i][j].toLocaleLowerCase())
str += list3[i][j].toLocaleLowerCase()
}
}
}
}
aa.push(str)
})
document.getElementById("result").value = aa.join();
}
</script>
</html>