C++ , winapi Compare two WCHAR * strings
21,058
Solution 1
For case sensitive comparison, look at wcscmp
For case insensitive comparison, look at _wcsicmp
Solution 2
You have to use the WCHAR_t
versions of strcmp
. You can find the definitions here.
For case insensitive comparison use wcscasecmp.
Solution 3
Have you considered using StrCmpLogicalW()? Depending on your need that might be preferable to wcscmp.
Author by
Hooch
Updated on May 27, 2020Comments
-
Hooch almost 4 years
I want to compare two
WCHAR*
strings.How to do it?
P.S. I would like to ignore case while comparing.
I know you can use
strcmpi
but it id not working forWCHAR*
. -
Hooch over 12 yearsHow to use it so that I can ignore case?
-
Hooch over 12 yearsAgain, this is case sensitive.
-
Thomas Russell over 12 yearsNo, it's not, take a look at the MSDN page. :-)
-
Matthew almost 10 years@SoumyajitRoy I'm sure something exists, but this question was tagged
winapi
. -
Ajay almost 7 yearsHowever,
StrCmpLogicalW
would care for prefix numbers in string.