var str = '$a1a2a_B3B4B$';
function transformCode(code) {
return code.replace(/([A-Z])|([a-z])/g, function(match, $1, $2) {
if ($1) {
return $1.toLowerCase();
} else if ($2) {
return $2.toUpperCase();
}
});
}
把字符串大小写切换的方法
猜你喜欢
转载自www.cnblogs.com/xiaoyucoding/p/12552265.html
今日推荐
周排行