Logo Search packages:      
Sourcecode: icu version File versions  Download package

U_STABLE int32_t U_EXPORT2 u_strCaseCompare ( const UChar *  s1,
int32_t  length1,
const UChar *  s2,
int32_t  length2,
uint32_t  options,
UErrorCode pErrorCode 

Compare two strings case-insensitively using full case folding. This is equivalent to u_strCompare(u_strFoldCase(s1, options), u_strFoldCase(s2, options), (options&U_COMPARE_CODE_POINT_ORDER)!=0).

The comparison can be done in UTF-16 code unit order or in code point order. They differ only when comparing supplementary code points (U+10000..U+10ffff) to BMP code points near the end of the BMP (i.e., U+e000..U+ffff). In code unit order, high BMP code points sort after supplementary code points because they are stored as pairs of surrogates which are at U+d800..U+dfff.

This functions works with strings of different explicitly specified lengths unlike the ANSI C-like u_strcmp() and u_memcmp() etc. NUL-terminated strings are possible with length arguments of -1.

s1 First source string.
length1 Length of first source string, or -1 if NUL-terminated.
s2 Second source string.
length2 Length of second source string, or -1 if NUL-terminated.
options A bit set of options:
  • U_FOLD_CASE_DEFAULT or 0 is used for default options: Comparison in code unit order with default case folding.
  • U_COMPARE_CODE_POINT_ORDER Set to choose code point order instead of code unit order (see u_strCompare for details).


pErrorCode Must be a valid pointer to an error code value, which must not indicate a failure before the function call.
<0 or 0 or >0 as usual for string comparisons
ICU 2.2

Definition at line 951 of file ustrcase.c.


    /* argument checking */
    if(pErrorCode==0 || U_FAILURE(*pErrorCode)) {
        return 0;
    if(s1==NULL || length1<-1 || s2==NULL || length2<-1) {
        return 0;
    return u_strcmpFold(s1, length1, s2, length2,

Generated by  Doxygen 1.6.0   Back to index