3.2.36. stricmp

Compares two strings without case distinction.

Syntax

int stricmp (str1, str2)
char *str1;
char *str2;

where:

str1

Variable of type pointer to char. Specifies the location in memory of the first byte of a character string.

str2

Variable of type pointer to char. Specifies the location in memory of the first byte of a character string.

Description

This macro performs string comparison without case distinction. The stricmp macro compares strings in ASCII sequence, ignoring case.

Return value

int

One of the following:

<0

Indicates that the second argument string value comes after the first argument string value in the machine collating sequences, independent of case distinction, str1 < str2.

0

Indicates that the two strings are identical in content, independent of case distinction.

>0

Indicates that the first argument string value comes after the second argument string value in the machine collating sequences, independent of case distinction, str2 < str1.

Rules

  • Strings are assumed to be NUL terminated or to fit within the array boundaries.

  • Comparisons are always signed, regardless of how the string is declared.

Example

This example shows how to use stricmp on the command line:

> ce stricmp("abcDEF","ABCdef")
  Result is: 0  0x00000000

See Also

Copyright © 2002-2009 ARM Limited. All rights reserved.ARM DUI 0175K
Non-Confidential