The WCollate method

This method compares wide character string s1 to wide character string s2 for sort order according to the rules of the current locale.

int WCollate(const ITWChar *s1, const ITWChar *s2, 
   int nwchars1 = ITLocale::ScanToNul, 
   int nwchars2 = ITLocale::ScanToNul) const

The nwchars1 and nwchars2 parameters specify the length of the s1 and s2 strings. You can provide an integer to specify the number of characters in the corresponding string. Or you can use the constant ITLocale::ScanToNul (the default) to specify that the corresponding string is null-terminated.

This method returns an integer that is:
  • Greater than 0 if s1 is greater than (after) s2 in sort order
  • Less than 0 if s1 is less than (before) s2 in sort order
  • 0 if s1 is equal to s2 in sort order

If there is an error, this method returns -1. Call ITLocale::GetError() to retrieve a specific error message.