This example shows how to compare Unicode strings without sensitivity to case.

#include <stdio.h>
#include <unidef.h>

int main(void) {

LocaleObject locale_object = NULL;

UniChar      ucs1[] = L"computer";
UniChar      ucs2[] = L"COMPUTER";
int          result = 0;
int          rc = ULS_SUCCESS;

         /*****************************************************************/
         /* Assumes LANG environment variable set to a valid locale name, */
         /* such as fr_FR                                                 */
         /*****************************************************************/

         rc = UniCreateLocaleObject(UNI_UCS_STRING_POINTER,
                                   (UniChar *)L"", &locale_object);

         if (rc != ULS_SUCCESS) {
           printf("UniCreateLocaleObject error: return code = %u\n", rc);
           return 1;
         }


         result = UniStrcmpi(locale_object, ucs1, ucs2);

         if ( result == 0 )
             printf("The strings are identical\n");
         else
             printf("The strings are not identical\n");

         return (ULS_SUCCESS);


}


[Back: UniStrcmpi - Related Functions]
[Next: UniStrcmpi - Topics]