upper

Convert strings to uppercase

Description

newStr = upper(str) converts all lowercase characters in str to the corresponding uppercase characters and leaves all other characters unchanged.

Examples

collapse all

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

Starting in R2017a, you can create string arrays using double quotes.

Convert a string array to contain uppercase characters.

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

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

Input Arguments

collapse all

Input array, specified as a string array, character array, or cell array of character vectors.

Tips

For character arrays, the upper function supports the character sets:

  • PC: Windows® Latin-1

  • Other: ISO® Latin-1 (ISO 8859-1)

For string arrays, the upper function supports Unicode®.

Extended Capabilities

Introduced before R2006a