Main Content

strcmpi

Compare strings (case insensitive)

Description

example

tf = strcmpi(str1,str2) compares strings str1 and str2, ignoring differences in letter case. The operator returns 1 (true) if the strings are identical and 0 (false) otherwise.

Note

The operator strcmpi is not supported in Stateflow® charts that use C as the action language.

Examples

expand all

Set x to 0 (false) because the strings do not match. Set y to 1 (true) because the strings match when you ignore case.

str1 = "Hello, World!";
str2 = "hello, world!";
x = strcmp(str1,str2);
y = strcmpi(str1,str2);

Stateflow chart that uses the strcmpi operator in a state.

Input Arguments

expand all

Input strings, specified as string scalars. Enclose literal string with double quotes.

Example: "Hello"

Limitations

Version History

Introduced in R2021b