Skip to content

Latest commit

 

History

History
113 lines (79 loc) · 4.24 KB

nf-shlwapi-strcmpnca.md

File metadata and controls

113 lines (79 loc) · 4.24 KB
UID title description helpviewer_keywords old-location tech.root ms.assetid ms.date ms.keywords req.header req.include-header req.target-type req.target-min-winverclnt req.target-min-winversvr req.kmdf-ver req.umdf-ver req.ddi-compliance req.unicode-ansi req.idl req.max-support req.namespace req.assembly req.type-library req.lib req.dll req.irql targetos req.typenames req.redist ms.custom f1_keywords dev_langs topic_type api_type api_location api_name
NF:shlwapi.StrCmpNCA
StrCmpNCA function (shlwapi.h)
Compares a specified number of characters from the beginning of two strings using C run-time (ASCII) collation rules. The comparison is case-sensitive. (ANSI)
StrCmpNCA
shlwapi/StrCmpNCA
shell\StrCmpNC.htm
shell
4b4f18d3-9325-4bd9-ac65-af7f3012fdaa
12/05/2018
StrCmpNC, StrCmpNC function [Windows Shell], StrCmpNCA, StrCmpNCW, _shell_StrCmpNC, shell.StrCmpNC, shlwapi/StrCmpNC, shlwapi/StrCmpNCA, shlwapi/StrCmpNCW
shlwapi.h
Windows
Windows 2000 Professional, Windows XP [desktop apps only]
Windows Server 2003 [desktop apps only]
StrCmpNCW (Unicode) and StrCmpNCA (ANSI)
Shlwapi.lib
Shlwapi.dll (version 5.0 or later)
Windows
19H1
StrCmpNCA
shlwapi/StrCmpNCA
c++
APIRef
kbSyntax
DllExport
Shlwapi.dll
API-MS-Win-Core-shlwapi-Obsolete-l1-1-0.dll
KernelBase.dll
API-MS-Win-Core-shlwapi-Obsolete-l1-2-0.dll
API-MS-Win-DownLevel-shlwapi-l1-1-0.dll
API-MS-Win-DownLevel-shlwapi-l1-1-1.dll
StrCmpNC
StrCmpNCA
StrCmpNCW

StrCmpNCA function

-description

Compares a specified number of characters from the beginning of two strings using C run-time (ASCII) collation rules. The comparison is case-sensitive.

-parameters

-param pszStr1 [in]

Type: LPCTSTR

A pointer to the first null-terminated string to be compared.

-param pszStr2 [in]

Type: LPCTSTR

A pointer to the second null-terminated string to be compared.

-param nChar

Type: int

The number of characters from the beginning of each string to be compared.

-returns

Type: int

Returns zero if the substrings are identical. Returns a positive value if the string taken from that pointed to by pszStr1 is alphabetically greater than the string taken from that pointed to by pszStr2. Returns a negative value if the string taken from that pointed to by pszStr1 is alphabetically less than the string taken from that pointed to by pszStr2.

-remarks

Note that StrCmpNC was designed for comparing canonical strings. These strings are not localized and consist only of characters below ASCII value 128. Therefore, it will not function correctly with a double-byte character set (DBCS) or other multiple-character data.

This function locates the first unequal characters and returns a positive number if the character from the first string is greater than the character from the second, a negative number if it is less, or zero if they are equal. For example, suppose that pszStr1="abczb", pszStr2="abcdefg", and you are comparing the first four characters from each. StrCmpNC determines that the first unequal character is at position four ("z" in pszStr1 and "d" in pszStr2) and returns a positive value since the ASCII code for "z" is greater than the ASCII code for "d".

For those versions of Windows that do not include StrCmpNC in Shlwapi.h, this function's individual ANSI or Unicode version must be called directly from Shlwapi.dll. StrCmpNCA is ordinal 151 and StrCmpNCW is ordinal 152.

Note

The shlwapi.h header defines StrCmpNC as an alias which automatically selects the ANSI or Unicode version of this function based on the definition of the UNICODE preprocessor constant. Mixing usage of the encoding-neutral alias with code that not encoding-neutral can lead to mismatches that result in compilation or runtime errors. For more information, see Conventions for Function Prototypes.

-see-also

CompareString

StrCmpC

StrCmpN