Next: Searching for a character in a Unicode string, Previous: Copying Unicode strings, Up: Elementary string functions [Contents][Index]
The following function compares two Unicode strings of the same length.
int u8_cmp (const uint8_t *s1, const uint8_t *s2, size_t n) ¶ int u16_cmp (const uint16_t *s1, const uint16_t *s2, size_t n) ¶ int u32_cmp (const uint32_t *s1, const uint32_t *s2, size_t n) ¶ Compares s1 and s2, each of length n, lexicographically. Returns a negative value if s1 compares smaller than s2, a positive value if s1 compares larger than s2, or 0 if they compare equal.
This function is similar to memcmp, except that it operates on
Unicode strings.
The following function compares two Unicode strings of possibly different lengths.
int u8_cmp2 (const uint8_t *s1, size_t n1, const uint8_t *s2, size_t n2) ¶ int u16_cmp2 (const uint16_t *s1, size_t n1, const uint16_t *s2, size_t n2) ¶ int u32_cmp2 (const uint32_t *s1, size_t n1, const uint32_t *s2, size_t n2) ¶ Compares s1 and s2, lexicographically. Returns a negative value if s1 compares smaller than s2, a positive value if s1 compares larger than s2, or 0 if they compare equal.
This function is similar to the gnulib function memcmp2, except that it
operates on Unicode strings.
Next: Searching for a character in a Unicode string, Previous: Copying Unicode strings, Up: Elementary string functions [Contents][Index]