Next Previous Contents

67. strcmp


Compare two strings


Interpret strcmp (String_Type a, String_Type b)


The strcmp function may be used to perform a case-sensitive string comparison, in the lexicongraphic sense, on strings a and b. It returns 0 if the strings are identical, a negative integer if a is less than b, or a positive integer if a is greater than b.


The strup function may be used to perform a case-insensitive string comparison:

    define case_insensitive_strcmp (a, b)
      return strcmp (strup(a), strup(b));

One may also use one of the binary comparison operators, e.g., a > b.

See Also

strup, strncmp

Next Previous Contents