Adding user defined rule to existing language

醉酒当歌 提交于 2019-12-25 08:44:53

问题


can anybody explain what the correct way is to load existing rules in a language and add some new to them. I do the following but the rule is not set.

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);

回答1:


I partially answered in my answer to your other question - I don't see anything wrong with how you are using the API itself, however you cannot tailor "''". Use the solution given in the other question. Or, maybe you can explain a bit more about what you are trying to do.



来源:https://stackoverflow.com/questions/6057922/adding-user-defined-rule-to-existing-language

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!