'I? love ?? the ?great ? ?wall in ?beijing'
用正则替换成
'I love the Great Wall in Beijing'
str.replace(/\?[^\s?]/g,function (m){
return m.toLocaleUpperCase();
}).replace(/(\s|\?)*(\s|\?)/g,' ')
我是这么实现的,结果是对了,不过也没达到要求,等待有缘人指出问题吧
此致
敬礼~
小旋风
我建了一个前端微信交流群,欢迎大家加入,qq中转群号:1076484243
网友评论