任何人都可以解释正确的方法是以一种语言加载现有规则并向它们添加一些新规则。我执行以下操作,但未设置规则。
void CompareTest()
{
UErrorCode status = U_ZERO_ERROR;
UChar ruleset[500]; *ruleset = 0;
int32_t rlen = 0;
UCollator *coll = ucol_open("de_DE", &status);
static const UChar rules[] = L"&\\u0000 = '' = '-'";
int32_t len=(int32_t)u_strlen(rules);
const UChar *defRules = ucol_getRules(coll, &rlen);
if(rlen > 0)
{
u_strcpy(ruleset, defRules);
}
u_strcat(ruleset, rules);
status = U_ZERO_ERROR;
UCollator *collRule = ucol_openRules(ruleset, u_strlen(ruleset),
UCOL_OFF,
UCOL_DEFAULT_STRENGTH,NULL, &status);