Programming and Data Types    

Comparing Strings For Equality

There are four functions that determine if two input strings are identical:

Consider the two strings

Strings str1 and str2 are not identical, so invoking strcmp returns 0 (false). For example,

The first three characters of str1 and str2 are identical, so invoking strncmp with any value up to 3 returns 1.

These functions work cell-by-cell on a cell array of strings. Consider the two cell arrays of strings

Now apply the string comparison functions.

  String Comparisons Comparing for Equality Using Operators