upper

Converts text to uppercase.

Category: Language Fundamentals > Data Types

Syntax

s = upper(str)

Returns str with all lowercase letters in uppercase.

Description

Only letters change; digits, punctuation and spaces are kept. Letters outside the basic alphabet are also converted according to Unicode rules, and some conversions change the length: in "straße" the German ß becomes SS.

It raises an error for non-text input such as a number. lower is the opposite function.

Input arguments

str
Character vector, string array, or cell array of character vectors.

Output arguments

s
Text of the same type and size.

Example

Characters, cells and strings

upper('abc')
upper({'ab','Cd'})
upper("straße")
Output
ans = 'ABC'
ans = 1×2 cell

    {'AB'}    {'CD'}
ans = "STRASSE"

See also

lower strcmpi regexprep char