您当前的位置:首页 > IT编程 > C++
| C语言 | Java | VB | VC | python | Android | TensorFlow | C++ | oracle | 学术与代码 | cnn卷积神经网络 | gnn | 图像修复 | Keras | 数据集 | Neo4j | 自然语言处理 | 深度学习 | 医学CAD | 医学影像 | 超参数 | pointnet | pytorch | 异常检测 | Transformers | 情感分类 | 知识图谱 |

自学教程:C++ ucol_strcoll函数代码示例

51自学网 2021-06-03 09:05:24
  C++
这篇教程C++ ucol_strcoll函数代码示例写得很实用,希望能帮到您。

本文整理汇总了C++中ucol_strcoll函数的典型用法代码示例。如果您正苦于以下问题:C++ ucol_strcoll函数的具体用法?C++ ucol_strcoll怎么用?C++ ucol_strcoll使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。

在下文中一共展示了ucol_strcoll函数的28个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: run

    virtual void run() {        //sleep(10000);        int32_t line = 0;        uint8_t sk1[1024], sk2[1024];        uint8_t *oldSk = NULL, *newSk = sk1;        int32_t resLen = 0, oldLen = 0;        int32_t i = 0;        for(i = 0; i < noLines; i++) {            resLen = ucol_getSortKey(coll, lines[i].buff, lines[i].buflen, newSk, 1024);            int32_t res = 0, cmpres = 0, cmpres2 = 0;            if(oldSk != NULL) {                res = strcmp((char *)oldSk, (char *)newSk);                cmpres = ucol_strcoll(coll, lines[i-1].buff, lines[i-1].buflen, lines[i].buff, lines[i].buflen);                cmpres2 = ucol_strcoll(coll, lines[i].buff, lines[i].buflen, lines[i-1].buff, lines[i-1].buflen);                //cmpres = res;                //cmpres2 = -cmpres;                if(cmpres != -cmpres2) {                    error("Compare result not symmetrical on line "+ line);                    break;                }                if(((res&0x80000000) != (cmpres&0x80000000)) || (res == 0 && cmpres != 0) || (res != 0 && cmpres == 0)) {                    error(UnicodeString("Difference between ucol_strcoll and sortkey compare on line ")+ UnicodeString(line));                    break;                }                if(res > 0) {                    error(UnicodeString("Line %i is not greater or equal than previous line ")+ UnicodeString(i));                    break;                } else if(res == 0) { /* equal */                    res = u_strcmpCodePointOrder(lines[i-1].buff, lines[i].buff);                    if (res == 0) {                        error(UnicodeString("Probable error in test file on line %i (comparing identical strings)")+ UnicodeString(i));                        break;                    }                    /*                     * UCA 6.0 test files can have lines that compare == if they are                     * different strings but canonically equivalent.                    else if (res > 0) {                        error(UnicodeString("Sortkeys are identical, but code point compare gives >0 on line ")+ UnicodeString(i));                        break;                    }                     */                }            }            oldSk = newSk;            oldLen = resLen;            newSk = (newSk == sk1)?sk2:sk1;        }    }
开发者ID:ACSOP,项目名称:android_external_icu4c,代码行数:57,


示例2: TestJB581

static void TestJB581(void){    UChar       dispName    [100];     int32_t     bufferLen   = 0;    UChar       source      [100];    UChar       target      [100];    UCollationResult result     = UCOL_EQUAL;    uint8_t     sourceKeyArray  [100];    uint8_t     targetKeyArray  [100];     int32_t     sourceKeyOut    = 0,                 targetKeyOut    = 0;    UCollator   *myCollator = 0;    UErrorCode status = U_ZERO_ERROR;    /*u_uastrcpy(source, "This is a test.");*/    /*u_uastrcpy(target, "THISISATEST.");*/    u_uastrcpy(source, "THISISATEST.");    u_uastrcpy(target, "Thisisatest.");    myCollator = ucol_open("en_US", &status);    if (U_FAILURE(status)){        bufferLen = uloc_getDisplayName("en_US", 0, dispName, 100, &status);        /*Report the error with display name... */        log_err("ERROR: Failed to create the collator for : /"%s/"/n", dispName);        return;    }    result = ucol_strcoll(myCollator, source, -1, target, -1);    /* result is 1, secondary differences only for ignorable space characters*/    if (result != 1)    {        log_err("Comparing two strings with only secondary differences in C failed./n");    }    /* To compare them with just primary differences */    ucol_setStrength(myCollator, UCOL_PRIMARY);    result = ucol_strcoll(myCollator, source, -1, target, -1);    /* result is 0 */    if (result != 0)    {        log_err("Comparing two strings with no differences in C failed./n");    }    /* Now, do the same comparison with keys */    sourceKeyOut = ucol_getSortKey(myCollator, source, -1, sourceKeyArray, 100);    targetKeyOut = ucol_getSortKey(myCollator, target, -1, targetKeyArray, 100);    bufferLen = ((targetKeyOut > 100) ? 100 : targetKeyOut);    if (memcmp(sourceKeyArray, targetKeyArray, bufferLen) != 0)    {        log_err("Comparing two strings with sort keys in C failed./n");    }    ucol_close(myCollator);}
开发者ID:HBelusca,项目名称:NasuTek-Odyssey,代码行数:50,


示例3: getEComparisonResult

Collator::EComparisonResult RuleBasedCollator::compare(                                             const UnicodeString& source,                                             const UnicodeString& target) const{    return getEComparisonResult(ucol_strcoll(ucollator, source.getBuffer(), source.length(),                                                        target.getBuffer(), target.length()));}
开发者ID:flwh,项目名称:Alcatel_OT_985_kernel,代码行数:7,


示例4: NativeCollation_compare

static jint NativeCollation_compare(JNIEnv* env, jclass, jint address, jstring lhs0, jstring rhs0) {    ScopedJavaUnicodeString lhs(env, lhs0);    ScopedJavaUnicodeString rhs(env, rhs0);    return ucol_strcoll(toCollator(address),            lhs.unicodeString().getBuffer(), lhs.unicodeString().length(),            rhs.unicodeString().getBuffer(), rhs.unicodeString().length());}
开发者ID:OMFGB,项目名称:libcore,代码行数:7,


示例5: collator_string_compare_function

static int collator_string_compare_function(CVarRef v1, CVarRef v2,                                            const void *data,                                            bool ascending) {  assert(data);  String str1;  if (v1.isString()) {    str1 = v1.toString();  } else {    UErrorCode status;    str1 = intl_convert_str_utf8_to_utf16(v1.toString(), &status);    if (U_FAILURE(status)) {      raise_warning("Error converting utf8 to utf16 in "                    "collator_string_compare_function()");    }  }  String str2;  if (v2.isString()) {    str2 = v2.toString();  } else {    UErrorCode status;    str2 = intl_convert_str_utf8_to_utf16(v2.toString(), &status);    if (U_FAILURE(status)) {      raise_warning("Error converting utf8 to utf16 in "                    "collator_string_compare_function()");    }  }  int ret = ucol_strcoll((const UCollator *)data,                         (UChar*)(str1.data()),                         UCHARS(str1.length()),                         (UChar*)(str2.data()),                         UCHARS(str2.length()));  return ascending ? ret : (-ret);}
开发者ID:changguanghua,项目名称:hiphop-php,代码行数:34,


示例6: createCollator

Collator::Result Collator::collate(const UChar* lhs, size_t lhsLength, const UChar* rhs, size_t rhsLength) const{    if (!m_collator)        createCollator();    return static_cast<Result>(ucol_strcoll(m_collator, lhs, lhsLength, rhs, rhsLength));}
开发者ID:SchleunigerAG,项目名称:WinEC7_Qt5.3.1_Fixes,代码行数:7,


示例7: NS_ENSURE_TRUE

NS_IMETHODIMP nsCollationMacUC::CompareString(int32_t strength, const nsAString& string1,                                              const nsAString& string2, int32_t* result){  NS_ENSURE_TRUE(mInit, NS_ERROR_NOT_INITIALIZED);  NS_ENSURE_ARG_POINTER(result);  *result = 0;  nsresult rv = EnsureCollator(strength);  NS_ENSURE_SUCCESS(rv, rv);  UCollationResult uresult;  uresult = ucol_strcoll(mCollatorICU,                          (const UChar*)PromiseFlatString(string1).get(), string1.Length(),                          (const UChar*)PromiseFlatString(string2).get(), string2.Length());  int32_t res;  switch (uresult) {    case UCOL_LESS:      res = -1;      break;    case UCOL_EQUAL:      res = 0;      break;    case UCOL_GREATER:      res = 1;      break;    default:      MOZ_CRASH("ucol_strcoll returned bad UCollationResult");  }  *result = res;  return NS_OK;}
开发者ID:MekliCZ,项目名称:positron,代码行数:31,


示例8: INSTANCE_METHOD_INJECTION_BUILTIN

Variant c_Collator::t_compare(CStrRef str1, CStrRef str2) {  INSTANCE_METHOD_INJECTION_BUILTIN(Collator, Collator::compare);  if (!m_ucoll) {    raise_warning("compare called on uninitialized Collator object");    return 0;  }  UChar* ustr1 = NULL;  UChar* ustr2 = NULL;  int ustr1_len = 0;  int ustr2_len = 0;  m_errcode.clear();  intl_convert_utf8_to_utf16(&ustr1, &ustr1_len,                             str1.data(), str1.length(),                             &(m_errcode.code));  if (U_FAILURE(m_errcode.code)) {    free(ustr1);    return false;  }  intl_convert_utf8_to_utf16(&ustr2, &ustr2_len,                             str2.data(), str2.length(),                             &(m_errcode.code));  if (U_FAILURE(m_errcode.code)) {    free(ustr1);    free(ustr2);    return false;  }  int64 ret = ucol_strcoll(m_ucoll, ustr1, ustr1_len, ustr2, ustr2_len);  free(ustr1);  free(ustr2);  return ret;}
开发者ID:cdnewbee,项目名称:hiphop-php,代码行数:31,


示例9: icu_Collator_strcmp

// Collator.strcmp {{{static PyObject *icu_Collator_strcmp(icu_Collator *self, PyObject *args, PyObject *kwargs) {    char *a_, *b_;    int32_t asz, bsz;    UChar *a, *b;    UErrorCode status = U_ZERO_ERROR;    UCollationResult res = UCOL_EQUAL;      if (!PyArg_ParseTuple(args, "eses", "UTF-8", &a_, "UTF-8", &b_)) return NULL;        asz = (int32_t)strlen(a_); bsz = (int32_t)strlen(b_);    a = (UChar*)calloc(asz*4 + 1, sizeof(UChar));    b = (UChar*)calloc(bsz*4 + 1, sizeof(UChar));    if (a == NULL || b == NULL) return PyErr_NoMemory();    u_strFromUTF8(a, asz*4 + 1, NULL, a_, asz, &status);    u_strFromUTF8(b, bsz*4 + 1, NULL, b_, bsz, &status);    PyMem_Free(a_); PyMem_Free(b_);    if (U_SUCCESS(status))        res = ucol_strcoll(self->collator, a, -1, b, -1);    free(a); free(b);    return Py_BuildValue("i", res);} // }}}
开发者ID:Kielek,项目名称:calibre,代码行数:30,


示例10: CFStringCompareWithOptionsAndLocale

CFComparisonResultCFStringCompareWithOptionsAndLocale (CFStringRef str1,  CFStringRef str2, CFRange rangeToCompare,  CFStringCompareFlags compareOptions, CFLocaleRef locale){  CFComparisonResult ret;  UniChar *string1;  UniChar *string2;  CFIndex length1;  CFIndex length2;  CFAllocatorRef alloc;  UCollator *ucol;    alloc = CFAllocatorGetDefault ();    length1 = rangeToCompare.length;  string1 = CFAllocatorAllocate (alloc, (length1) * sizeof(UniChar), 0);  CFStringGetCharacters (str1, rangeToCompare, string1);    length2 = CFStringGetLength (str2);  string2 = CFAllocatorAllocate (alloc, (length2) * sizeof(UniChar), 0);  CFStringGetCharacters (str2, CFRangeMake(0, length2), string2);    ucol = CFStringICUCollatorOpen (compareOptions, locale);  ret = ucol_strcoll (ucol, string2, length2, string1, length1);  CFStringICUCollatorClose (ucol);    CFAllocatorDeallocate (alloc, string1);  CFAllocatorDeallocate (alloc, string2);  return ret;}
开发者ID:erichocean,项目名称:myos.android.frameworks,代码行数:31,


示例11: createCollator

Collator::Result Collator::collate(const UChar* lhs, size_t lhsLength, const UChar* rhs, size_t rhsLength) const{#ifndef USE_TI_UCOL_REPLACEMENTS    if (!m_collator)        createCollator();    return static_cast<Result>(ucol_strcoll(m_collator, lhs, lhsLength, rhs, rhsLength));#else    RetainPtr<CFStringRef> localeStr = CFStringCreateWithCString(NULL, m_locale, kCFStringEncodingASCII);    RetainPtr<CFLocaleRef> locale = CFLocaleCreate(NULL, localeStr.get());        if (!locale) {        locale = CFLocaleCopyCurrent();    }        // We assume that lhsLength/rhsLength != -1, which is reasonable based on the source.        RetainPtr<CFStringRef> lhsRef = CFStringCreateWithCharacters(NULL, (const UniChar*)lhs, lhsLength);    RetainPtr<CFStringRef> rhsRef = CFStringCreateWithCharacters(NULL, (const UniChar*)rhs, rhsLength);        return static_cast<Result>(CFStringCompareWithOptionsAndLocale(lhsRef.get(),                                                                    rhsRef.get(),                                                                    CFRangeMake(0, CFStringGetLength(lhsRef.get())),                                                                    kCFCompareLocalized,                                                                    locale.get()));#endif}
开发者ID:BlainHamon,项目名称:tijscore,代码行数:27,


示例12: ucol_open

U_CDECL_END#define LINES 6void CollationThaiTest::TestInvalidThai(void) {  const char *tests[LINES] = {    "//u0E44//u0E01//u0E44//u0E01",    "//u0E44//u0E01//u0E01//u0E44",    "//u0E01//u0E44//u0E01//u0E44",    "//u0E01//u0E01//u0E44//u0E44",    "//u0E44//u0E44//u0E01//u0E01",    "//u0E01//u0E44//u0E44//u0E01",  };  UChar strings[LINES][20];  UChar *toSort[LINES];  int32_t i = 0, j = 0, len = 0;  UErrorCode coll_status = U_ZERO_ERROR;  UnicodeString iteratorText;  thaiColl = ucol_open ("th_TH", &coll_status);  if (U_FAILURE(coll_status)) {    errln("Error opening Thai collator: %s", u_errorName(coll_status));    return;  }  CollationElementIterator* c = ((RuleBasedCollator *)coll)->createCollationElementIterator( iteratorText );  for(i = 0; i < (int32_t)(sizeof(tests)/sizeof(tests[0])); i++) {    len = u_unescape(tests[i], strings[i], 20);    strings[i][len] = 0;    toSort[i] = strings[i];  }  qsort (toSort, LINES, sizeof (UChar *), StrCmp);  for (i=0; i < LINES; i++)  {    logln("%i", i);      for (j=i+1; j < LINES; j++) {          if (ucol_strcoll (thaiColl, toSort[i], -1, toSort[j], -1) == UCOL_GREATER)          {              // inconsistency ordering found!            errln("Inconsistent ordering between strings %i and %i", i, j);          }      }      iteratorText.setTo(toSort[i]);      c->setText(iteratorText, coll_status);      backAndForth(*c);  }    ucol_close(thaiColl);  delete c;}
开发者ID:CoDEmanX,项目名称:ArangoDB,代码行数:59,


示例13: collator_regular_compare_function

static int collator_regular_compare_function(CVarRef v1, CVarRef v2,                                             const void *data,                                             bool ascending) {  Variant str1 = collator_convert_object_to_string(v1);  Variant str2 = collator_convert_object_to_string(v2);  Variant num1;  Variant num2;  Variant norm1;  Variant norm2;  /* If both args are strings AND either of args is not numeric string   * then use ICU-compare. Otherwise PHP-compare. */  if (str1.isString() && str2.isString()) {    num1 = collator_convert_string_to_number_if_possible(str1);    if (!same(num1, false)) {      num2 = collator_convert_string_to_number_if_possible(str2);    }    if (same(num1, false) || same(num2, false)) {      assert(data);      int ret = ucol_strcoll((const UCollator *)data,                             (UChar*)(str1.toString().data()),                             UCHARS(str1.toString().length()),                             (UChar*)(str2.toString().data()),                             UCHARS(str2.toString().length()));      return ascending ? ret : (-ret);    }  }  /* num1 is set if str1 and str2 are strings. */  if (!num1.isNull()) {    if (same(num1, false)) {      /* str1 is string but not numeric string just convert it to utf8. */      UErrorCode status;      norm1 = intl_convert_str_utf16_to_utf8(str1, &status);      if (U_FAILURE(status)) {        raise_warning("Error converting utf16 to utf8 in "                      "collator_regular_compare_function()");      }      /* num2 is not set but str2 is string => do normalization. */      norm2 = collator_normalize_sort_argument(str2);    } else {      /* str1 is numeric strings => passthru to PHP-compare. */      norm1 = num1;      norm2 = num2;    }  } else {    /* str1 or str2 is not a string => do normalization. */    norm1 = collator_normalize_sort_argument(str1);    norm2 = collator_normalize_sort_argument(str2);  }  if (ascending) {    if (norm1.less(norm2)) return -1;    if (norm1.equal(norm2)) return 0;    return 1;  }  if (norm1.less(norm2)) return 1;  if (norm1.equal(norm2)) return 0;  return -1;}
开发者ID:changguanghua,项目名称:hiphop-php,代码行数:59,


示例14: _swift_stdlib_unicode_compare_utf16_utf16

int32_t _swift_stdlib_unicode_compare_utf16_utf16(const uint16_t *LeftString,                                                  int32_t LeftLength,                                                  const uint16_t *RightString,                                                  int32_t RightLength) {  return ucol_strcoll(GetRootCollator(),    LeftString, LeftLength,    RightString, RightLength);}
开发者ID:bumaociyuan,项目名称:swift,代码行数:8,


示例15: Java_com_ibm_icu4jni_text_NativeCollation_compare

//static jint NativeCollation_compare(JNIEnv* env, jclass, jint address, jstring lhs0, jstring rhs0) {JNIEXPORT jint JNICALLJava_com_ibm_icu4jni_text_NativeCollation_compare(JNIEnv* env, jclass,		jint address, jstring lhs0, jstring rhs0) {	ScopedJavaUnicodeString lhs(env, lhs0);	ScopedJavaUnicodeString rhs(env, rhs0);	return ucol_strcoll(toCollator(address), lhs.unicodeString().getBuffer(),			lhs.unicodeString().length(), rhs.unicodeString().getBuffer(),			rhs.unicodeString().length());}
开发者ID:webos21,项目名称:xi,代码行数:10,


示例16: defined

/// Compares the strings via the Unicode Collation Algorithm on the root locale./// Results are the usual string comparison results:///  <0 the left string is less than the right string./// ==0 the strings are equal according to their collation.///  >0 the left string is greater than the right string.int32_tswift::_swift_stdlib_unicode_compare_utf16_utf16(const uint16_t *LeftString,                                                 int32_t LeftLength,                                                 const uint16_t *RightString,                                                 int32_t RightLength) {#if defined(__CYGWIN__) || defined(_MSC_VER) || defined(__MINGW32__)  // ICU UChar type is platform dependent. In Cygwin, it is defined  // as wchar_t which size is 2. It seems that the underlying binary  // representation is same with swift utf16 representation.  return ucol_strcoll(GetRootCollator(),    reinterpret_cast<const UChar *>(LeftString), LeftLength,    reinterpret_cast<const UChar *>(RightString), RightLength);#else  return ucol_strcoll(GetRootCollator(),    LeftString, LeftLength,    RightString, RightLength);#endif}
开发者ID:akrisiun,项目名称:swiftwindows,代码行数:23,


示例17: ucol_equal

/* convenience function for comparing strings */U_CAPI UBool U_EXPORT2ucol_equal(        const    UCollator        *coll,            const    UChar            *source,            int32_t            sourceLength,            const    UChar            *target,            int32_t            targetLength){    return (ucol_strcoll(coll, source, sourceLength, target, targetLength)        == UCOL_EQUAL);}
开发者ID:GuillaumeSmaha,项目名称:stringi,代码行数:11,


示例18: ucol_greaterOrEqual

/* convenience function for comparing strings */U_CAPI UBool U_EXPORT2ucol_greaterOrEqual(    const    UCollator    *coll,            const    UChar        *source,            int32_t        sourceLength,            const    UChar        *target,            int32_t        targetLength){    return (ucol_strcoll(coll, source, sourceLength, target, targetLength)        != UCOL_LESS);}
开发者ID:GuillaumeSmaha,项目名称:stringi,代码行数:11,


示例19: ucol_greater

/* convenience function for comparing strings */U_CAPI UBool U_EXPORT2ucol_greater(    const    UCollator        *coll,        const    UChar            *source,        int32_t            sourceLength,        const    UChar            *target,        int32_t            targetLength){    return (ucol_strcoll(coll, source, sourceLength, target, targetLength)        == UCOL_GREATER);}
开发者ID:GuillaumeSmaha,项目名称:stringi,代码行数:11,


示例20: NativeCollation_compare

static jint NativeCollation_compare(JNIEnv* env, jclass, jlong address, jstring javaLhs, jstring javaRhs) {    ScopedStringChars lhs(env, javaLhs);    if (lhs.get() == NULL) {        return 0;    }    ScopedStringChars rhs(env, javaRhs);    if (rhs.get() == NULL) {        return 0;    }    return ucol_strcoll(toCollator(address), lhs.get(), lhs.size(), rhs.get(), rhs.size());}
开发者ID:dicej,项目名称:android-libcore64,代码行数:11,


示例21: compareUnicode

static int compareUnicode(const char* str1, size_t len1,                          const char* str2, size_t len2){    static UCollator* coll = NULL;    UChar *b1;    UChar *b2;    int ret1, ret2;    int result;    UErrorCode status = U_ZERO_ERROR;    if (!coll) {        coll = ucol_open("", &status);        if (U_FAILURE(status)) {            fprintf(stderr, "CouchStore CollateJSON: Couldn't initialize ICU (%d)/n", (int)status);            return -1;        }    }    if (len1 > 256 || len2 > 256) {        return compareUnicodeSlow(str1, len1, str2, len2);    }    b1 = malloc(len1 * sizeof(UChar));    b2 = malloc(len2 * sizeof(UChar));    if (b1 == NULL || b2 == NULL) {        free(b1);        free(b2);        fprintf(stderr, "CouchStore CollateJSON: Couldn't allocate memory/n");        return -2;    }    ret1 = convertUTF8toUChar(str1, b1, len1);    ret2 = convertUTF8toUChar(str2, b2, len2);    if (ret1 < 0 || ret2 < 0) {        /* something went wrong with utf8->utf32 conversion */        free(b1);        free(b2);        return compareUnicodeSlow(str1, len1, str2, len2);    }    result = ucol_strcoll(coll, b1, len1, b2, len2);    free(b1);    free(b2);    if (result < 0) {        return -1;    } else if (result > 0) {        return 1;    }    return 0;}
开发者ID:alemic,项目名称:couchstore,代码行数:54,


示例22: ucol_strcoll

UCollationResult RuleBasedCollator::compare(                                             const UnicodeString& source,                                             const UnicodeString& target,                                             UErrorCode &status) const{    if(U_SUCCESS(status)) {        return ucol_strcoll(ucollator, source.getBuffer(), source.length(),                                       target.getBuffer(), target.length());    } else {        return UCOL_EQUAL;    }}
开发者ID:flwh,项目名称:Alcatel_OT_985_kernel,代码行数:12,


示例23: collate16

static int collate16(void *p, int n1, const void *v1, int n2, const void *v2){    UCollator *coll = (UCollator *) p;    UCollationResult result = ucol_strcoll(coll, (const UChar *) v1, n1,                                                 (const UChar *) v2, n2);    if (result == UCOL_LESS) {        return -1;    } else if (result == UCOL_GREATER) {        return 1;    } else {        return 0;    }}
开发者ID:nining,项目名称:platform_external_sqlite,代码行数:14,


示例24: compare_current

int compare_current(const void *string1, const void *string2) {  if(compareCollator != NULL) {    UCollationResult res = ucol_strcoll(compareCollator, (UChar *) string1, -1, (UChar *) string2, -1);    if(res == UCOL_LESS) {      return -1;    } else if(res == UCOL_GREATER) {      return 1;    } else {      return 0;    }  } else {    return 0;  }}
开发者ID:winlibs,项目名称:icu4c,代码行数:14,


示例25: strcmp

/** * ICU string comparison */int strcmp() {	UChar source[100];	UChar target[100];	u_unescape(opt_source, source, 100);	u_unescape(opt_target, target, 100);    UCollationResult result = ucol_strcoll(collator, source, -1, target, -1);    if (result == UCOL_LESS) {		return -1;	}    else if (result == UCOL_GREATER) {		return 1;	}	return 0;}
开发者ID:winlibs,项目名称:icu4c,代码行数:18,


示例26: icuCollationColl

/*** Collation sequence comparison function. The pCtx argument points to** a UCollator structure previously allocated using ucol_open().*/static int icuCollationColl(  void *pCtx,  int nLeft,  const void *zLeft,  int nRight,  const void *zRight){  UCollationResult res;  UCollator *p = (UCollator *)pCtx;  res = ucol_strcoll(p, (UChar *)zLeft, nLeft/2, (UChar *)zRight, nRight/2);  switch( res ){    case UCOL_LESS:    return -1;    case UCOL_GREATER: return +1;    case UCOL_EQUAL:   return 0;  }  assert(!"Unexpected return value from ucol_strcoll()");  return 0;}
开发者ID:520060628,项目名称:Sqlite3.07.14,代码行数:22,


示例27: HHVM_METHOD

static Variant HHVM_METHOD(Collator, compare, const Variant& str1, const Variant& str2) {  FETCH_COL(data, this_, false);  data->clearError();  UErrorCode error = U_ZERO_ERROR;  icu::UnicodeString ustr1(u16(str1.toString(), error));  if (U_FAILURE(error)) {    data->setError(error);    return false;  }  error = U_ZERO_ERROR;  icu::UnicodeString ustr2(u16(str2.toString(), error));  if (U_FAILURE(error)) {    data->setError(error);    return false;  }  return (int64_t)ucol_strcoll(data->collator(),                               ustr1.getBuffer(), ustr1.length(),                               ustr2.getBuffer(), ustr2.length());}
开发者ID:Dream-Seeker,项目名称:hhvm,代码行数:19,


示例28: icu_Collator_strcmp

// Collator.strcmp {{{static PyObject *icu_Collator_strcmp(icu_Collator *self, PyObject *args, PyObject *kwargs) {    PyObject *a_ = NULL, *b_ = NULL;    int32_t asz = 0, bsz = 0;    UChar *a = NULL, *b = NULL;    UCollationResult res = UCOL_EQUAL;      if (!PyArg_ParseTuple(args, "OO", &a_, &b_)) return NULL;    a = python_to_icu(a_, &asz, 1);    if (a == NULL) goto end;    b = python_to_icu(b_, &bsz, 1);    if (b == NULL) goto end;    res = ucol_strcoll(self->collator, a, asz, b, bsz);end:    if (a != NULL) free(a); if (b != NULL) free(b);    return (PyErr_Occurred()) ? NULL : Py_BuildValue("i", res);} // }}}
开发者ID:IvoNet,项目名称:calibre,代码行数:20,



注:本文中的ucol_strcoll函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


C++ ucs_assert函数代码示例
C++ ucol_setAttribute函数代码示例
万事OK自学网:51自学网_软件自学网_CAD自学网自学excel、自学PS、自学CAD、自学C语言、自学css3实例,是一个通过网络自主学习工作技能的自学平台,网友喜欢的软件自学网站。