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

U_STABLE int32_t U_EXPORT2 u_strncmp ( const UChar *  ucs1,
const UChar *  ucs2,
int32_t  n 
)

Compare two ustrings for bitwise equality. Compares at most n characters.

Parameters:
ucs1 A string to compare.
ucs2 A string to compare.
n The maximum number of characters to compare.
Returns:
0 if s1 and s2 are bitwise equal; a negative value if s1 is bitwise less than s2; a positive value if s1 is bitwise greater than s2. ICU 2.0

Definition at line 938 of file ustring.c.

{
    if(n > 0) {
        int32_t rc;
        for(;;) {
            rc = (int32_t)*s1 - (int32_t)*s2;
            if(rc != 0 || *s1 == 0 || --n == 0) {
                return rc;
            }
            ++s1;
            ++s2;
        }
    } else {
        return 0;
    }
}


Generated by  Doxygen 1.6.0   Back to index