This example shows how to compare a specific number of code elements without sensitivity to case.
#include <stdio.h>
#include <unidef.h>
int main(void) {
LocaleObject locale_object;
UniChar ucs1[] = L"COMPUTER";
UniChar ucs2[] = L"computer program";
size_t num_elems = 3;
int result = 0;
int rc;
/*****************************************************************/
/* 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 = UniStrncmpi(locale_object, ucs1, ucs2, num_elems);
if ( result == 0 )
printf("The strings are identical\n");
else
printf("The strings are not identical\n");
return (ULS_SUCCESS);
}