将数据库字段名转换成Java字段名
比如:
CREATED_DATE
CREATED_BY
UPDATED_DATE
UPDATED_BY
转换成:
createdDate
createdBy
updatedDate
updatedBy
<html>
<head>
<meta http-equiv= "Content-Type " content= "text/html; charset=gb2312 ">
<title> Capital Word </title>
<script>
function zm_shouzimudaxie(){
zm_tihuanneirong( document.getElementById("zm_neirong").value.replace(/\b\w+\b/g,function(a){return a.substring(0,1).toUpperCase() + a.substring(1) }))
}
function zm_shouzimuxiaoxie(){
zm_tihuanneirong( document.getElementById("zm_neirong").value.replace(/\b\w+\b/g,function(a){return a.substring(0,1).toLowerCase()+a.substring(1) }))
}
function zm_quanbudaxie(){zm_tihuanneirong(document.getElementById("zm_neirong").value.toUpperCase())}
function zm_quanbuxiaoxie(){zm_tihuanneirong(document.getElementById("zm_neirong").value.toLowerCase())}
function zm_tihuanneirong(a){document.getElementById("zm_neirong").value=a;}
function zm_javafeild(){
//zm_tihuanneirong( document.getElementById("zm_neirong").value.replace(/(\b|_)[a-zA-Z0-9]+(\b|_)/g,function(a){return a.substring(0,1).toLowerCase()+a.substring(1).toUpperCase() }))
zm_tihuanneirong( document.getElementById("zm_neirong").value.replace(/\_/g," ") );
//str.replace(/\-/g,"!")
zm_tihuanneirong( document.getElementById("zm_neirong").value.replace(/\b\w+\b/g,function(a){return a.substring(0,1).toUpperCase()+a.substring(1).toLowerCase() }) );
zm_tihuanneirong( document.getElementById("zm_neirong").value.replace(/ /g,"") );
zm_shouzimuxiaoxie();
}
</script>
</head>
<body >
<div align="center">
<textarea id="zm_neirong" style="border: 1px solid #d9d9d9;height: 160px;width: 95%;"></textarea>
<br /><br />
<input type="button" value="转换为大写" οnclick="zm_quanbudaxie();" />
<input type="button" value="转换为小写" οnclick="zm_quanbuxiaoxie();" />
<input type="button" value="转换首字母为大写" οnclick="zm_shouzimudaxie();" />
<input type="button" value="转换首字母为小写" οnclick="zm_shouzimuxiaoxie();" />
<input type="button" value="转换db字段为java feild名" οnclick="zm_javafeild();" />
</div>
</body>
</html>