_strnicmp, _fstrnicmp

Description

Compare characters of two strings without regard to case.

#include <string.h> Required only for function declarations  

int _strnicmp( const char *string1, const char *string2, size_t count );

int __far _fstrnicmp( const char __far *string1, const char __far *string2,
size_t count );

string1 String to compare  
string2 String to compare  
count Number of characters compared  

Remarks

The _strnicmp and _fstrnicmp functions lexicographically compare (without regard to case), at most, the first count characters of string1 and string2 and return a value indicating the relationship between the substrings, as listed below:

Value Meaning

< 0 string1 less than string2
= 0 string1 equivalent to string2
> 0 string1 greater than string2

The strncmp function is a case-sensitive version of _strnicmp.

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 _fstrnicmp function is a model-independent (large-model) form of the _strnicmp function. The behavior and return value of _fstrnicmp are identical to those of the model-dependent function _strnicmp, with the exception that all the arguments and return values are far.

Return Value

The return values for these functions are described above.

Compatibility

_strnicmp

Standards:None

16-Bit:DOS, QWIN, WIN, WIN DLL

32-Bit:DOS32X

_fstrnicmp

Standards:None

16-Bit:DOS, QWIN, WIN, WIN DLL

32-Bit:None

See Also

strcat, strcmp, strcpy, strncat, strncpy, strrchr, _strset, strspn

Example

See the example for strncmp.