// 将一个单词的首字母大写
function wordUpperCase(word){
var wLength = word.length;
if(wLength > 0){
var ss = (word.substring(0,1).toUpperCase()) + (word.substring(1,wLength).toLowerCase()+" ");
}
return ss;
}
// 将一个句子的每个单词的首字母大写
function sentenceUpperCase(sentence){
var upperSentence = '';
var array = sentence.split(' ');
for(i = 0 ;i < array.length ; i++){
upperSentence += wordUpperCase(array[i]);
}
return upperSentence;
}
阅读(1366) | 评论(0) | 转发(0) |
<script type=text/javascript charset=utf-8 src="http://static.bshare.cn/b/buttonLite.js#style=-1&uuid=&pophcol=3&lang=zh"></script> <script type=text/javascript charset=utf-8 src="http://static.bshare.cn/b/bshareC0.js"></script>
function wordUpperCase(word){
var wLength = word.length;
if(wLength > 0){
var ss = (word.substring(0,1).toUpperCase()) + (word.substring(1,wLength).toLowerCase()+" ");
}
return ss;
}
// 将一个句子的每个单词的首字母大写
function sentenceUpperCase(sentence){
var upperSentence = '';
var array = sentence.split(' ');
for(i = 0 ;i < array.length ; i++){
upperSentence += wordUpperCase(array[i]);
}
return upperSentence;
}
相关热门文章
给主人留下些什么吧!~~
评论热议