powerdong / myProblems

我用到了,你可能用到
0 stars 1 forks source link

JS用正则将小写字母转换为大写 #29

Open powerdong opened 4 years ago

powerdong commented 4 years ago
var str="xi nAn shi you xUe yuan china people"   
console.log(
str.replace(/[a-z]/g,function($1){
return $1.toLocaleUpperCase()
})
)