string::CompareNoCase

Description

Perform a case-insensitive comparison of this string object with another string.

Syntax

int CompareNoCase( LPCSTR lpsz )

Parameters

lpsz
[input]The other string used for comparison.

Return

Zero if the strings are identical, < 0 if this string object is less than lpsz, or > 0 if this string object is greater than lpsz.

Examples

EX1

void string_CompareNoCase_ex1()
{
        string str1("abc");
        int nRet;
        nRet = str1.CompareNoCase("ABc");
        out_int("", nRet); // 0
        
        nRet = str1.CompareNoCase("ABB");
        out_int("", nRet); // 1
        
        nRet = str1.CompareNoCase("abz");
        out_int("", nRet); // -1    
}

Remark

See Also

string::Compare

header to Include

origin.h