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

U_STABLE int32_t U_EXPORT2 u_strCompare ( const UChar *  s1,
int32_t  length1,
const UChar *  s2,
int32_t  length2,
UBool  codePointOrder 
)

Compare two Unicode strings (binary order).

The comparison can be done in code unit order or in code point order. They differ only in UTF-16 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.

Parameters:
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.
codePointOrder Choose between code unit order (FALSE) and code point order (TRUE).
Returns:
<0 or 0 or >0 as usual for string comparisons
ICU 2.2

Definition at line 921 of file ustring.c.

References FALSE, and NULL.

                                   {
    /* argument checking */
    if(s1==NULL || length1<-1 || s2==NULL || length2<-1) {
        return 0;
    }
    return uprv_strCompare(s1, length1, s2, length2, FALSE, codePointOrder);
}


Generated by  Doxygen 1.6.0   Back to index