Next: , Previous: Case mappings of characters, Up: unicase.h


13.2 Case mappings of strings

Case mapping should always be performed on entire strings, not on individual characters. The functions in this sections do so.

These functions allow to apply a normalization after the case mapping. The reason is that if you want to treat ‘ä’ and ‘Ä’ the same, you most often also want to treat the composed and decomposed forms of such a character, U+00C4 LATIN CAPITAL LETTER A WITH DIAERESIS and U+0041 LATIN CAPITAL LETTER A U+0308 COMBINING DIAERESIS the same. The nf argument designates the normalization.

These functions are locale dependent. The iso639_language argument identifies the language (e.g. "tr" for Turkish). NULL means to use locale independent case mappings.

— Function: const char * uc_locale_language ()

Returns the ISO 639 language code of the current locale. Returns "" if it is unknown, or in the "C" locale.

— Function: uint8_t * u8_toupper (const uint8_t *s, size_t n, const char *iso639_language, uninorm_t nf, uint8_t *resultbuf, size_t *lengthp)
— Function: uint16_t * u16_toupper (const uint16_t *s, size_t n, const char *iso639_language, uninorm_t nf, uint16_t *resultbuf, size_t *lengthp)
— Function: uint32_t * u32_toupper (const uint32_t *s, size_t n, const char *iso639_language, uninorm_t nf, uint32_t *resultbuf, size_t *lengthp)

Returns the uppercase mapping of a string.

The nf argument identifies the normalization form to apply after the case-mapping. It can also be NULL, for no normalization.

— Function: uint8_t * u8_tolower (const uint8_t *s, size_t n, const char *iso639_language, uninorm_t nf, uint8_t *resultbuf, size_t *lengthp)
— Function: uint16_t * u16_tolower (const uint16_t *s, size_t n, const char *iso639_language, uninorm_t nf, uint16_t *resultbuf, size_t *lengthp)
— Function: uint32_t * u32_tolower (const uint32_t *s, size_t n, const char *iso639_language, uninorm_t nf, uint32_t *resultbuf, size_t *lengthp)

Returns the lowercase mapping of a string.

The nf argument identifies the normalization form to apply after the case-mapping. It can also be NULL, for no normalization.

— Function: uint8_t * u8_totitle (const uint8_t *s, size_t n, const char *iso639_language, uninorm_t nf, uint8_t *resultbuf, size_t *lengthp)
— Function: uint16_t * u16_totitle (const uint16_t *s, size_t n, const char *iso639_language, uninorm_t nf, uint16_t *resultbuf, size_t *lengthp)
— Function: uint32_t * u32_totitle (const uint32_t *s, size_t n, const char *iso639_language, uninorm_t nf, uint32_t *resultbuf, size_t *lengthp)

Returns the titlecase mapping of a string.

Mapping to title case means that, in each word, the first cased character is being mapped to title case and the remaining characters of the word are being mapped to lower case.

The nf argument identifies the normalization form to apply after the case-mapping. It can also be NULL, for no normalization.