CString str1 = "Hello"; CString str2 = "HELLO"; if(str1.CompareNoCase(str2) == 0) { // strings are equal (ignoring case sensitivity) }
CString str1 = "C++"; CString str2 = "Java"; if(str1.CompareNoCase(str2) > 0) { // str1 is greater } else if(str1.CompareNoCase(str2) < 0) { // str2 is greater } else { // strings are equal }In this example, two strings "C++" and "Java" are compared using the CompareNoCase function. As the function ignores the case sensitivity of characters, the result would be greater than 0, indicating that the first string "C++" is greater than the second string "Java". Package/library: MFC (Microsoft Foundation Classes) library.