lower

Converts text to lowercase.

Category: Language Fundamentals > Data Types

Syntax

s2 = lower(s)

Returns s with every uppercase letter changed to lowercase.

Description

Only letters change; digits, punctuation and characters without a case stay as they are. Accented letters are converted too, so lower('Ç') gives 'ç'. A cell array is processed element by element.

It is typically used to compare text without regard to case, as in strcmp(lower(a), lower(b)), though strcmpi does that directly.

Input arguments

s
Character array, string array, or cell array of character vectors.

Output arguments

s2
Text of the same class and size as s.

Example

Text of different classes

lower('Hello World 1')
lower("ABC")
lower({'AB', 'Cd'})
Output
ans = 'hello world 1'
ans = "abc"
ans = 1×2 cell

    {'ab'}    {'cd'}

See also

upper strcmpi regexprep string