码迷,mamicode.com
首页 > Web开发 > 详细

js中设置单词首字母大写

时间:2015-03-05 14:35:00      阅读:108      评论:0      收藏:0      [点我收藏+]

标签:

1 function ReplaceFirstUper(str)  
2 {     
3     str = str.toLowerCase();     
4     return str.replace(/\b(\w)|\s(\w)/g, function(m){  
5         return m.toUpperCase();  
6     });    
7 }  

 

js中设置单词首字母大写

标签:

原文地址:http://www.cnblogs.com/forver/p/4315647.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!