Open ziwei3749 opened 6 years ago
题目1: 把类似于 is_good 这样的变量名替换成 isGood
原题: http://scriptoj.mangojuice.top/problems/29
const toCamelCaseVar = (str) => { return str.replace(/([^_])_+([^_])/g,(match,$1,$2,index,str) => { console.log(match) console.log($1) console.log($2) return $1+$2.toUpperCase() }) }
注意点:
[^_]
正则练习
原题: http://scriptoj.mangojuice.top/problems/29
注意点:
[^_]
匹配除了_之外的任意字符