strcmp

Purpose

Compare strings.

Synopsis

l = strcmp('str1','str2')

Description

l = strcmp('str1','str2') compares the strings str1 and str2 and returns 1 if the two are identical, and 0 otherwise. Note that the value returned by strcmp is not the same as the C language convention.

strcmp is case sensitive; any leading and trailing blanks in either of the strings are explicitly included in the comparison.

Examples

strcmp('Yes','No') =
   0
          
strcmp('Yes','Yes') =
   1

See Also

isstr, lower, setstr, upper

(c) Copyright 1994 by The MathWorks, Inc.