当前位置: 首页 > 文档资料 > Lazy.js 英文文档 >

toUpperCase

优质
小牛编辑
132浏览
2023-12-01

Converts all of the characters in this string to uppercase.

Signature

StringLikeSequence.toUpperCase = function() { /*...*/ }
StringLikeSequence.toUpperCase = function toUpperCase() {
  return this.mapString(function(char) { return char.toUpperCase(); });
}
NameType(s)Description
returnsStringLikeSequence

A new sequence with the same characters as this sequence, all uppercase.

Examples

function nextLetter(a) {
  return String.fromCharCode(a.charCodeAt(0) + 1);
}

Lazy('foo').toUpperCase()                       // sequence: 'FOO'
Lazy('foo').substring(1).toUpperCase()          // sequence: 'OO'
Lazy('abc').mapString(nextLetter).toUpperCase() // sequence: 'BCD'