windows核心编程---CompareString函数
CompareString
The CompareString function compares two character strings, using the specified locale.
FlagMeaningNORM_IGNORECASE LINGUISTIC_IGNORECASE忽略大小写。NORM_IGNOREKANATYPE不区分平假名和片假名。NORM_IGNORENONSPACE LINGUISTIC_IGNOREDIACRITIC忽略 nonspacing字符.NORM_IGNORESYMBOLS忽略符号。NORM_IGNOREWIDTH不区分相同字符的单字节和双字节字符。SORT_STRINGSORT将标点按符号处理。 函数CompareString剩余的四个参数指定两个字符串及它们各自的字符长度(并非字节长度)。如果给参数cch1传了负值,函数会假定字符串pStirng1是零字符结尾,并计算字符串长度。同样,字符串pString2和参数cch2也是如此。
int CompareStringOrdinal( __in LPCWSTR lpString1, __in int cchCount1, __in LPCWSTR lpString2, __in int cchCount2, __in BOOL bIgnoreCase);
Pointer to the first string to compare.
cchCount1 [in]Length of the string indicated by lpString1. The application supplies -1 if the string is null-terminated. In this case, the function determines the length automatically.
lpString2 [in]Pointer to the second string to compare.
cchCount2 [in]Length of the string indicated by lpString2. The application supplies -1 if the string is null-terminated. In this case, the function determines the length automatically.
bIgnoreCase [in]TRUE if the function is to perform a case-insensitive comparison, using the operating system uppercase table information. The application sets this parameter to FALSE if the function is to compare the strings exactly as they are passed in.
Returns one of the following values if successful. To maintain the C runtime convention of comparing strings, the value 2 can be subtracted from a nonzero return value. Then, the meaning of <0, ==0, and >0 is consistent with the C runtime.
The function returns 0 if it does not succeed. To get extended error information, the application can callGetLastError, which can return one of the following error codes: