美文网首页
toLowerCase()把字符串转换为小写和toUpperCa

toLowerCase()把字符串转换为小写和toUpperCa

作者: 黄怼怼 | 来源:发表于2017-08-23 22:57 被阅读0次

定义和用法
toLowerCase() 方法用于把字符串转换为小写。

语法
stringObject.toLowerCase()

返回值
一个新的字符串,在其中 stringObject 的所有大写字符全部被转换为了小写字符。

"Today is Wednesday" 将以小写字母来显示:

<script type="text/javascript">

var str="Today is Wednesday"
document.write(str.toLowerCase())
//输出结果today is wednesday
</script>

定义和用法
toUpperCase() 方法用于把字符串转换为大写。

语法
stringObject.toUpperCase()

返回值
一个新的字符串,在其中 stringObject 的所有小写字符全部被转换为了大写字符。

"today is wednesday" 将以大写字母来显示:

<script type="text/javascript">

var str="today is wednesday"
document.write(str.toUpperCase())
//输出结果TODAY IS WEDNESDAY
</script>

相关文章

网友评论

      本文标题:toLowerCase()把字符串转换为小写和toUpperCa

      本文链接:https://www.haomeiwen.com/subject/biajdxtx.html