Compares a specified number of UTF-8 characters.
#include "slapi-plugin.h" int slapi_UTF-8NCASECMP(char *s0, char *s1, int n);
This function takes the following parameters:
A NULL terminated UTF-8 string.
A NULL terminated UTF-8 string.
The number of UTF-8 characters (not bytes) from s0 and s1 to compare.
This function returns one of the following values:
positive number if s0 is after s1.
0 if the two string are identical, ignoring case.
negative number if s1 is after s0.
This function has the following rules:
If both UTF-8 strings are NULL or 0-length, 0 is returned.
If one of the strings is NULL or 0-length, the NULL or 0-length string is smaller.
If one or both of the strings are not UTF-8, system provided strcasecmp is used.
If one of the two strings contains no 8-bit characters, strcasecmp is used.
The strings are compared after they are converted to lower-case UTF-8.
Each character is compared from the beginning.
Evaluation occurs in this order:
If the length of one character is shorter then the other, the difference of the two lengths is returned.
If the length of the corresponding characters is the same, each byte in the characters is compared.
If there is a difference between two bytes, the difference is returned.
If one string is shorter then the other, the difference is returned.