Perform a lowercase comparison of strings.
#include <string.h> | Required only for function declarations |
int _stricmp( const char *string1, const char *string2 );
int __far _fstricmp( const char __far *string1, const char __far *string2 );
string1 | String to compare | |
string2 | String to compare |
The _stricmp and _fstricmp functions perform a lexicographical comparison of lowercase versions of string1 and string2 and return a value indicating their relationship, as follows:
Value | Meaning |
< 0 | string1 less than string2 |
= 0 | string1 identical to string2 |
> 0 | string1 greater than string2 |
Note that two strings containing characters located between 'Z' and 'a' in the ASCII table ('[', '\', ']', '^', '_', and '`') compare differently depending on their case. For example, the two strings, "ABCDE" and "ABCD^", compare one way if the comparison is lowercase ("abcde" > "abcd^") and compare the other way ("ABCDE" < "ABCD^") if it is uppercase.
The _stricmp and _fstricmp functions operate on null-terminated strings. The string arguments to these functions are expected to contain a null character ('\0') marking the end of the string.
The _fstricmp function is a model-independent (large-model) form of the _stricmp function. The behavior and return value of _fstricmp are identical to those of the model-dependent function _stricmp, with the exception that the arguments are far pointers.
The _strcmpi function is functionally equivalent to _stricmp. It is included in STRING.H for compatibility with previous versions of Microsoft C. The preferred form is _stricmp.
The strcmp function is a case-sensitive version of _stricmp.
The return values for these functions are described above.
_stricmp
Standards:None
16-Bit:DOS, QWIN, WIN, WIN DLL
32-Bit:DOS32X
_fstricmp
Standards:None
16-Bit:DOS, QWIN, WIN, WIN DLL
32-Bit:None
memcmp, _memicmp, strcat, strcpy, strncat, strncmp, strncpy, _strnicmp, strrchr, _strset, strspn
See the example for strcmp.