Main Content

upper

将字符串转换为大写

说明

newStr = upper(str)str 中的所有小写字符转换为相应的大写字符并保留所有其他字符不变。

示例

全部折叠

upper('Hello, World.')
ans = 
'HELLO, WORLD.'

转换字符串数组以包含大写字符。

str = ["The SOONER,";"the BETTER."]
str = 2x1 string
    "The SOONER,"
    "the BETTER."

newStr = upper(str)
newStr = 2x1 string
    "THE SOONER,"
    "THE BETTER."

输入参数

全部折叠

输入数组,指定为字符串数组、字符数组或字符向量元胞数组。

提示

对于字符数组,upper 函数支持以下字符集:

  • PC:Windows® Latin-1

  • 其他:ISO® Latin-1 (ISO 8859-1)

对于字符串数组,upper 函数支持 Unicode®

扩展功能

版本历史记录

在 R2006a 之前推出