Function

uni_casefoldcmp

Case-insensitive string comparison.

Since v1.0
unistat uni_casefoldcmp(
unicasefold casing, const void *s1, unisize s1_len, uniattr s1_attr, const void *s2, unisize s2_len, uniattr s2_attr, bool *result)

Parameters πŸ”—

casing in

Case fold form.

s1 in

First string.

s1_len in

Number of code units in s1 or -1 if it’s null terminated.

s1_attr in

Attributes of s1.

s2 in

Second string.

s2_len in

Number of code units in s2 or -1 if it’s null terminated.

s2_attr in

Attributes of s2.

result out

Set to true if s1 and s2 are equivalent; else false.

Return Value πŸ”—

UNI_OK

If text was checked successfully.

UNI_BAD_OPERATION

If s1 or s2 are NULL, or if result is NULL.

UNI_BAD_ENCODING

If s1 or s2 is not well-formed (checks are omitted if the corresponding uniattr has UNI_TRUST).

UNI_FEATURE_DISABLED

If the library was built without support for case folding.

UNI_NO_MEMORY

If dynamic memory allocation failed.

Discussion πŸ”—

Check if s1 and s2 are a caseless match in casing form casing. If they match, then the implementation writes true to result else it writes false.

The length and text attributes for s1 are specified by s1_len and s1_attr. The length and text attributes for s2 are specified by s2_len and s2_attr. If s1_len is -1, then the implementation assumes s1 is null terminated. If s2_len is -1, then the implementation assumes s2 is null terminated.