标签:js
JS正则表达式:全文单词首字母大写
function ReplaceFirstUper(str)
{
str = str.toLowerCase();
return str.replace(/\b(\w)|\s(\w)/g, function(m){
return m.toUpperCase();
});
}
console.log(ReplaceFirstUper(‘i have a pen, i have an apple!‘));标签:js
原文地址:http://13136447.blog.51cto.com/13126447/1956568