Compartir a través de


_strnicmp, _wcsnicmp (Windows CE 5.0)

Send Feedback

Developing an Application > Microsoft C Run-time Library for Windows CE > Run-time Library Reference

Compare characters of two strings without regard to case.

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

Parameters

  • string1, string2
    Null-terminated strings to compare.
  • count
    Number of characters to compare.

Return Values

The return value indicates the relationship between the substrings as follows.

Return Value Description
< 0 string1 substring less than string2 substring
0 string1 substring identical to string2 substring
> 0 string1 substring greater than string2 substring

Remarks

These functions are supported by all versions of the C run-time libraries.

The _strnicmp function lexicographically compares, at most, the first count characters of string1 and string2. The comparison is performed without regard to case; _strnicmp is a case-insensitive version of strncmp. The comparison ends if a terminating null character is reached in either string before count characters are compared.

If the strings are equal when a terminating null character is reached in either string before count characters are compared, the shorter string is lesser.

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 the other way ("ABCDE" < "ABCD^") if it is uppercase.

_wcsnicmp is a wide-character version of _strnicmp. The arguments and return value of _wcsnicmp are wide-character strings. These two functions behave identically otherwise. These functions are not affected by the current locale setting.

The following table shows generic-text routine mappings for this function.

TCHAR.H Routine _UNICODE Defined
_tcsncicmp _wcsnicmp
_tcsnicmp _wcsnicmp

For more information about TCHAR.H routines, see Generic Text Mappings.

Requirements

OS Versions: Windows CE 2.0 and later.

Header: stdio.h, string.h.

Link Library: coredll.dll.

See Also

strcat | strcmp | strcpy | strncat | strncmp | strncpy

Send Feedback on this topic to the authors

Feedback FAQs

© 2006 Microsoft Corporation. All rights reserved.