JS中string方法中常用方法之十二:String.prototype.toLowerCase()和String.prototype.toUpperCase()
2016-09-15 16:39
603 查看
String.prototype.toLowerCase()会将调用该方法的字符串值转为小写形式,并返回
语法:str.toLowerCase()
描述:
toLowerCase 会将调用该方法的字符串值转为小写形式,并返回。toLowerCase 不会影响字符串本身的值。
//例子:使用 toLowerCase()
console.log( "ALPHABET".toLowerCase() ); // "alphabet"
String.prototype.toUpperCase()将调用该方法的字符串值转换为大写形式,并返回。
语法:str.toUpperCase()
描述:
toUpperCase 将调用该方法的字符串值转换为大写形式,并返回。toUpperCase 方法不影响字符串本身的值。
//例子:使用 toUpperCase
console.log( "alphabet".toUpperCase() ); // "ALPHABET"
语法:str.toLowerCase()
描述:
toLowerCase 会将调用该方法的字符串值转为小写形式,并返回。toLowerCase 不会影响字符串本身的值。
//例子:使用 toLowerCase()
console.log( "ALPHABET".toLowerCase() ); // "alphabet"
String.prototype.toUpperCase()将调用该方法的字符串值转换为大写形式,并返回。
语法:str.toUpperCase()
描述:
toUpperCase 将调用该方法的字符串值转换为大写形式,并返回。toUpperCase 方法不影响字符串本身的值。
//例子:使用 toUpperCase
console.log( "alphabet".toUpperCase() ); // "ALPHABET"
相关文章推荐
- JS中string方法中常用方法之十:String.prototype.toLocaleLowerCase()
- JS中string方法中常用方法之十一:String.prototype.toLocaleUpperCase()
- JS中Array方法中常用方法九:Array.prototype.toString()
- JS中string方法中常用方法之一:String.prototype.charAt()
- js中精确判断对象类型--关于typeof 和Object.prototype.toString方法的区别
- 【记录】JS toUpperCase toLowerCase 大写字母/小写字母转换
- JS常用方法--String.prototype使用!
- JS:1.8,字符串(string)对象(length,indexOf(),lastIndexOf(),replace(),match(),toUpperCase(),toLowerCase())
- js中通过Object.prototype.toString方法----精确判断对象的类型
- js中通过Object.prototype.toString方法----精确判断对象的类型
- JS中string方法中常用方法之九:String.prototype.match()
- JS中string方法中常用方法之十三:String.prototype.replace()
- JS:1.8字符串(string)对象(length,indexOf(),lastIndexOf(),replace(),match(),toUpperCase(),toLowerCase())
- js的toLowerCase方法用法实例
- JS中string方法中常用方法之三:String.prototype.charCodeAt()
- JS中string方法中常用方法之六:String.prototype.substring()
- JS中string方法中常用方法之五:String.prototype.slice()
- 动手动脑之Stringequals()方法,整理String类的Length(),charAt(),getChars(),replace(),toUpperCase(),toLowerCase(),trim(),toCharArray()使用说明
- js中toLowerCase()方法的作用
- JS中string方法中常用方法之七:String.prototype.search()