HP-UX Directory Server 8.1 plug-in reference

Table Of Contents
Parameters This function takes the following parameters:
A null-terminated UTF-8 string.
s0
A null-terminated UTF-8 string.
s1
Returns This function returns one of the following values:
A positive number if s0 is after s1.
0 if the two string are identical, ignoring case.
A negative number if s1 is after s0.
41.4 slapi_utf8ncasecmp()
Description This function takes two UTF-8 strings (s0, s1) of unsigned char to be compared
for a specified number of characters. The rules are the same as in “slapi_utf8casecmp()” except
the n characters limit.
Do not use this function for collation as there is no notion of locale in this function; its UTF-8
code order, which is different from the locale-based collation. Also, the comparison is for n
characters, not n bytes.
Syntax
#include "slapi-plugin.h"
int slapi_utf8ncasecmp(unsigned char *s0, unsigned char *s1, int n);
Parameters This function takes the following parameters:
A null-terminated UTF-8 string.
s0
A null-terminated UTF-8 string.
s1
The number of UTF-8 characters (not bytes) from s0 and s1 to compare.n
Returns This function returns one of the following values:
A positive number if s0 is after s1.
0 if the two string are identical, ignoring case.
A negative number if s1 is after s0.
41.5 slapi_UTF8NCASECMP()
Description Compares a specified number of UTF-8 characters. This function has the following
rules:
If both UTF-8 strings are NULL or zero-length, 0 is returned.
If one of the strings is NULL or zero-length, the NULL/zero-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 string contains no 8-bit characters, strcasecmp is used.
The strings are compared after they are converted to lowercase 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.
41.4 slapi_utf8ncasecmp() 329