js字符串大小写转换

var str = 'hello world';
alert(str.toUpperCase());//将字符串转换为大写。
alert(str.toLowerCase());//将字符串转换为小写。
alert(str.toLocaleUpperCase());//也是将字符串转换为大写的一种方式
不同的是toLocaleUpperCase()//按照本地方式来转换为大写。
alert(str.toLocaleLowerCase());//按照本地方式来转换为小写。
“toLocaleUpperCase 返回一个字符串,其中所有的字母字符都被转换为大写,同时适应宿主环境的当前区域设置 
toLocaleLowerCase 返回一个字符串,其中所有的字母字符都被转换为小写,同时考虑到宿主环境的当前区域设置 ”








文字转载自http://blog.csdn.net/tiemufeng1122/article/details/8210352



posted @ 2016-03-17 21:25  dzxczx  阅读(1225)  评论(0编辑  收藏  举报