This example shows how to scan a Unicode string for an attribute match.
#include <stdio.h> #include <unidef.h> int main(void) { LocaleObject locale_object = NULL; AttrObject attr_object = NULL; int result = 0; int rc = ULS_SUCCESS; size_t offset = 0; UniChar *uni_char = L"os2"; /*****************************************************************/ /* 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; } /* Create an attribute object */ rc = UniCreateAttrObject(locale_object, (UniChar *)L"digit", &attr_object); if (rc != ULS_SUCCESS) { printf("UniCreateAttrObject error: return code = %u\n", rc); return 1; } /* Make call to determine if string matches attributes */ rc = UniScanForAttr(attr_object, uni_char, UniStrlen(uni_char), FALSE, &offset); if (rc != ULS_SUCCESS) { printf("UniScanForAttr error: return code = %u\n", rc); return 1; } return ULS_SUCCESS; }