1@node unicase.h
2@chapter Case mappings @code{<unicase.h>}
3
4This include file defines functions for case mapping for Unicode strings and
5case insensitive comparison of Unicode strings and C strings.
6
7These string functions fix the problems that were mentioned in
8@ref{char * strings}, namely, they handle the Croatian
9@sc{LETTER DZ WITH CARON}, the German @sc{LATIN SMALL LETTER SHARP S}, the
10Greek sigma and the Lithuanian i correctly.
11
12@menu
13* Case mappings of characters::
14* Case mappings of strings::
15* Case mappings of substrings::
16* Case insensitive comparison::
17* Case detection::
18@end menu
19
20@node Case mappings of characters
21@section Case mappings of characters
22
23@cindex Unicode character, case mappings
24The following functions implement case mappings on Unicode characters ---
25for those cases only where the result of the mapping is a again a single
26Unicode character.
27
28These mappings are locale and context independent.
29
30@cartouche
31@strong{WARNING!} These functions are not sufficient for languages such as
32German, Greek and Lithuanian.  Better use the functions below that treat an
33entire string at once and are language aware.
34@end cartouche
35
36@deftypefun ucs4_t uc_toupper (ucs4_t @var{uc})
37Returns the uppercase mapping of the Unicode character @var{uc}.
38@end deftypefun
39
40@deftypefun ucs4_t uc_tolower (ucs4_t @var{uc})
41Returns the lowercase mapping of the Unicode character @var{uc}.
42@end deftypefun
43
44@deftypefun ucs4_t uc_totitle (ucs4_t @var{uc})
45Returns the titlecase mapping of the Unicode character @var{uc}.
46
47The titlecase mapping of a character is to be used when the character should
48look like upper case and the following characters are lower cased.
49
50For most characters, this is the same as the uppercase mapping.  There are
51only few characters where the title case variant and the uuper case variant
52are different.  These characters occur in the Latin writing of the Croatian,
53Bosnian, and Serbian languages.
54
55@c Normally we would use .33 space for each column, but this is too much in
56@c TeX mode, see
57@c <http://lists.gnu.org/archive/html/bug-texinfo/2009-05/msg00016.html>.
58@multitable @columnfractions .31 .31 .31
59@headitem Lower case @tab Title case @tab Upper case
60@item LATIN SMALL LETTER LJ
61 @tab LATIN CAPITAL LETTER L WITH SMALL LETTER J
62 @tab LATIN CAPITAL LETTER LJ
63@item LATIN SMALL LETTER NJ
64 @tab LATIN CAPITAL LETTER N WITH SMALL LETTER J
65 @tab LATIN CAPITAL LETTER NJ
66@item LATIN SMALL LETTER DZ
67 @tab LATIN CAPITAL LETTER D WITH SMALL LETTER Z
68 @tab LATIN CAPITAL LETTER DZ
69@item LATIN SMALL LETTER DZ WITH CARON
70 @tab LATIN CAPITAL LETTER D WITH SMALL LETTER Z WITH CARON
71 @tab LATIN CAPITAL LETTER DZ WITH CARON
72@end multitable
73@end deftypefun
74
75@node Case mappings of strings
76@section Case mappings of strings
77
78@cindex case mappings
79@cindex uppercasing
80@cindex lowercasing
81@cindex titlecasing
82Case mapping should always be performed on entire strings, not on individual
83characters.  The functions in this sections do so.
84
85These functions allow to apply a normalization after the case mapping.  The
86reason is that if you want to treat @samp{@"{a}} and @samp{@"{A}} the same,
87you most often also want to treat the composed and decomposed forms of such
88a character, U+00C4 @sc{LATIN CAPITAL LETTER A WITH DIAERESIS} and
89U+0041 @sc{LATIN CAPITAL LETTER A} U+0308 @sc{COMBINING DIAERESIS} the same.
90The @var{nf} argument designates the normalization.
91
92@cindex locale language
93These functions are locale dependent.  The @var{iso639_language} argument
94identifies the language (e.g@. @code{"tr"} for Turkish).  NULL means to use
95locale independent case mappings.
96
97@deftypefun {const char *} uc_locale_language ()
98Returns the ISO 639 language code of the current locale.
99Returns @code{""} if it is unknown, or in the "C" locale.
100@end deftypefun
101
102@deftypefun {uint8_t *} u8_toupper (const uint8_t *@var{s}, size_t @var{n}, const char *@var{iso639_language}, uninorm_t @var{nf}, uint8_t *@var{resultbuf}, size_t *@var{lengthp})
103@deftypefunx {uint16_t *} u16_toupper (const uint16_t *@var{s}, size_t @var{n}, const char *@var{iso639_language}, uninorm_t @var{nf}, uint16_t *@var{resultbuf}, size_t *@var{lengthp})
104@deftypefunx {uint32_t *} u32_toupper (const uint32_t *@var{s}, size_t @var{n}, const char *@var{iso639_language}, uninorm_t @var{nf}, uint32_t *@var{resultbuf}, size_t *@var{lengthp})
105Returns the uppercase mapping of a string.
106
107The @var{nf} argument identifies the normalization form to apply after the
108case-mapping.  It can also be NULL, for no normalization.
109
110The @var{resultbuf} and @var{lengthp} arguments are as described in
111chapter @ref{Conventions}.
112@end deftypefun
113
114@deftypefun {uint8_t *} u8_tolower (const uint8_t *@var{s}, size_t @var{n}, const char *@var{iso639_language}, uninorm_t @var{nf}, uint8_t *@var{resultbuf}, size_t *@var{lengthp})
115@deftypefunx {uint16_t *} u16_tolower (const uint16_t *@var{s}, size_t @var{n}, const char *@var{iso639_language}, uninorm_t @var{nf}, uint16_t *@var{resultbuf}, size_t *@var{lengthp})
116@deftypefunx {uint32_t *} u32_tolower (const uint32_t *@var{s}, size_t @var{n}, const char *@var{iso639_language}, uninorm_t @var{nf}, uint32_t *@var{resultbuf}, size_t *@var{lengthp})
117Returns the lowercase mapping of a string.
118
119The @var{nf} argument identifies the normalization form to apply after the
120case-mapping.  It can also be NULL, for no normalization.
121
122The @var{resultbuf} and @var{lengthp} arguments are as described in
123chapter @ref{Conventions}.
124@end deftypefun
125
126@deftypefun {uint8_t *} u8_totitle (const uint8_t *@var{s}, size_t @var{n}, const char *@var{iso639_language}, uninorm_t @var{nf}, uint8_t *@var{resultbuf}, size_t *@var{lengthp})
127@deftypefunx {uint16_t *} u16_totitle (const uint16_t *@var{s}, size_t @var{n}, const char *@var{iso639_language}, uninorm_t @var{nf}, uint16_t *@var{resultbuf}, size_t *@var{lengthp})
128@deftypefunx {uint32_t *} u32_totitle (const uint32_t *@var{s}, size_t @var{n}, const char *@var{iso639_language}, uninorm_t @var{nf}, uint32_t *@var{resultbuf}, size_t *@var{lengthp})
129Returns the titlecase mapping of a string.
130
131Mapping to title case means that, in each word, the first cased character
132is being mapped to title case and the remaining characters of the word
133are being mapped to lower case.
134
135The @var{nf} argument identifies the normalization form to apply after the
136case-mapping.  It can also be NULL, for no normalization.
137
138The @var{resultbuf} and @var{lengthp} arguments are as described in
139chapter @ref{Conventions}.
140@end deftypefun
141
142@node Case mappings of substrings
143@section Case mappings of substrings
144
145Case mapping of a substring cannot simply be performed by extracting the
146substring and then applying the case mapping function to it.  This does not
147work because case mapping requires some information about the surrounding
148characters.  The following functions allow to apply case mappings to
149substrings of a given string, while taking into account the characters that
150precede it (the ``prefix'') and the characters that follow it (the ``suffix'').
151
152@deftp Type casing_prefix_context_t
153This data type denotes the case-mapping context that is given by a prefix
154string.  It is an immediate type that can be copied by simple assignment,
155without involving memory allocation.  It is not an array type.
156@end deftp
157
158@deftypevr Constant casing_prefix_context_t unicase_empty_prefix_context
159This constant is the case-mapping context that corresponds to an empty prefix
160string.
161@end deftypevr
162
163The following functions return @code{casing_prefix_context_t} objects:
164
165@deftypefun casing_prefix_context_t u8_casing_prefix_context (const uint8_t *@var{s}, size_t @var{n})
166@deftypefunx casing_prefix_context_t u16_casing_prefix_context (const uint16_t *@var{s}, size_t @var{n})
167@deftypefunx casing_prefix_context_t u32_casing_prefix_context (const uint32_t *@var{s}, size_t @var{n})
168Returns the case-mapping context of a given prefix string.
169@end deftypefun
170
171@deftypefun casing_prefix_context_t u8_casing_prefixes_context (const uint8_t *@var{s}, size_t @var{n}, casing_prefix_context_t @var{a_context})
172@deftypefunx casing_prefix_context_t u16_casing_prefixes_context (const uint16_t *@var{s}, size_t @var{n}, casing_prefix_context_t @var{a_context})
173@deftypefunx casing_prefix_context_t u32_casing_prefixes_context (const uint32_t *@var{s}, size_t @var{n}, casing_prefix_context_t @var{a_context})
174Returns the case-mapping context of the prefix concat(@var{a}, @var{s}),
175given the case-mapping context of the prefix @var{a}.
176@end deftypefun
177
178@deftp Type casing_suffix_context_t
179This data type denotes the case-mapping context that is given by a suffix
180string.  It is an immediate type that can be copied by simple assignment,
181without involving memory allocation.  It is not an array type.
182@end deftp
183
184@deftypevr Constant casing_suffix_context_t unicase_empty_suffix_context
185This constant is the case-mapping context that corresponds to an empty suffix
186string.
187@end deftypevr
188
189The following functions return @code{casing_suffix_context_t} objects:
190
191@deftypefun casing_suffix_context_t u8_casing_suffix_context (const uint8_t *@var{s}, size_t @var{n})
192@deftypefunx casing_suffix_context_t u16_casing_suffix_context (const uint16_t *@var{s}, size_t @var{n})
193@deftypefunx casing_suffix_context_t u32_casing_suffix_context (const uint32_t *@var{s}, size_t @var{n})
194Returns the case-mapping context of a given suffix string.
195@end deftypefun
196
197@deftypefun casing_suffix_context_t u8_casing_suffixes_context (const uint8_t *@var{s}, size_t @var{n}, casing_suffix_context_t @var{a_context})
198@deftypefunx casing_suffix_context_t u16_casing_suffixes_context (const uint16_t *@var{s}, size_t @var{n}, casing_suffix_context_t @var{a_context})
199@deftypefunx casing_suffix_context_t u32_casing_suffixes_context (const uint32_t *@var{s}, size_t @var{n}, casing_suffix_context_t @var{a_context})
200Returns the case-mapping context of the suffix concat(@var{s}, @var{a}),
201given the case-mapping context of the suffix @var{a}.
202@end deftypefun
203
204The following functions perform a case mapping, considering the
205prefix context and the suffix context.
206
207@deftypefun {uint8_t *} u8_ct_toupper (const uint8_t *@var{s}, size_t @var{n}, casing_prefix_context_t @var{prefix_context}, casing_suffix_context_t @var{suffix_context}, const char *@var{iso639_language}, uninorm_t @var{nf}, uint8_t *@var{resultbuf}, size_t *@var{lengthp})
208@deftypefunx {uint16_t *} u16_ct_toupper (const uint16_t *@var{s}, size_t @var{n}, casing_prefix_context_t @var{prefix_context}, casing_suffix_context_t @var{suffix_context}, const char *@var{iso639_language}, uninorm_t @var{nf}, uint16_t *@var{resultbuf}, size_t *@var{lengthp})
209@deftypefunx {uint32_t *} u32_ct_toupper (const uint32_t *@var{s}, size_t @var{n}, casing_prefix_context_t @var{prefix_context}, casing_suffix_context_t @var{suffix_context}, const char *@var{iso639_language}, uninorm_t @var{nf}, uint32_t *@var{resultbuf}, size_t *@var{lengthp})
210Returns the uppercase mapping of a string that is surrounded by a prefix
211and a suffix.
212
213The @var{resultbuf} and @var{lengthp} arguments are as described in
214chapter @ref{Conventions}.
215@end deftypefun
216
217@deftypefun {uint8_t *} u8_ct_tolower (const uint8_t *@var{s}, size_t @var{n}, casing_prefix_context_t @var{prefix_context}, casing_suffix_context_t @var{suffix_context}, const char *@var{iso639_language}, uninorm_t @var{nf}, uint8_t *@var{resultbuf}, size_t *@var{lengthp})
218@deftypefunx {uint16_t *} u16_ct_tolower (const uint16_t *@var{s}, size_t @var{n}, casing_prefix_context_t @var{prefix_context}, casing_suffix_context_t @var{suffix_context}, const char *@var{iso639_language}, uninorm_t @var{nf}, uint16_t *@var{resultbuf}, size_t *@var{lengthp})
219@deftypefunx {uint32_t *} u32_ct_tolower (const uint32_t *@var{s}, size_t @var{n}, casing_prefix_context_t @var{prefix_context}, casing_suffix_context_t @var{suffix_context}, const char *@var{iso639_language}, uninorm_t @var{nf}, uint32_t *@var{resultbuf}, size_t *@var{lengthp})
220Returns the lowercase mapping of a string that is surrounded by a prefix
221and a suffix.
222
223The @var{resultbuf} and @var{lengthp} arguments are as described in
224chapter @ref{Conventions}.
225@end deftypefun
226
227@deftypefun {uint8_t *} u8_ct_totitle (const uint8_t *@var{s}, size_t @var{n}, casing_prefix_context_t @var{prefix_context}, casing_suffix_context_t @var{suffix_context}, const char *@var{iso639_language}, uninorm_t @var{nf}, uint8_t *@var{resultbuf}, size_t *@var{lengthp})
228@deftypefunx {uint16_t *} u16_ct_totitle (const uint16_t *@var{s}, size_t @var{n}, casing_prefix_context_t @var{prefix_context}, casing_suffix_context_t @var{suffix_context}, const char *@var{iso639_language}, uninorm_t @var{nf}, uint16_t *@var{resultbuf}, size_t *@var{lengthp})
229@deftypefunx {uint32_t *} u32_ct_totitle (const uint32_t *@var{s}, size_t @var{n}, casing_prefix_context_t @var{prefix_context}, casing_suffix_context_t @var{suffix_context}, const char *@var{iso639_language}, uninorm_t @var{nf}, uint32_t *@var{resultbuf}, size_t *@var{lengthp})
230Returns the titlecase mapping of a string that is surrounded by a prefix
231and a suffix.
232
233The @var{resultbuf} and @var{lengthp} arguments are as described in
234chapter @ref{Conventions}.
235@end deftypefun
236
237For example, to uppercase the UTF-8 substring between @code{s + start_index}
238and @code{s + end_index} of a string that extends from @code{s} to
239@code{s + u8_strlen (s)}, you can use the statements
240
241@smallexample
242size_t result_length;
243uint8_t result =
244  u8_ct_toupper (s + start_index, end_index - start_index,
245                 u8_casing_prefix_context (s, start_index),
246                 u8_casing_suffix_context (s + end_index,
247                                           u8_strlen (s) - end_index),
248                 iso639_language, NULL, NULL, &result_length);
249@end smallexample
250
251@node Case insensitive comparison
252@section Case insensitive comparison
253
254@cindex comparing, ignoring case
255@cindex comparing, ignoring normalization and case
256The following functions implement comparison that ignores differences in case
257and normalization.
258
259@deftypefun {uint8_t *} u8_casefold (const uint8_t *@var{s}, size_t @var{n}, const char *@var{iso639_language}, uninorm_t @var{nf}, uint8_t *@var{resultbuf}, size_t *@var{lengthp})
260@deftypefunx {uint16_t *} u16_casefold (const uint16_t *@var{s}, size_t @var{n}, const char *@var{iso639_language}, uninorm_t @var{nf}, uint16_t *@var{resultbuf}, size_t *@var{lengthp})
261@deftypefunx {uint32_t *} u32_casefold (const uint32_t *@var{s}, size_t @var{n}, const char *@var{iso639_language}, uninorm_t @var{nf}, uint32_t *@var{resultbuf}, size_t *@var{lengthp})
262Returns the case folded string.
263
264Comparing @code{u8_casefold (@var{s1})} and @code{u8_casefold (@var{s2})}
265with the @code{u8_cmp2} function is equivalent to comparing @var{s1} and
266@var{s2} with @code{u8_casecmp}.
267
268The @var{nf} argument identifies the normalization form to apply after the
269case-mapping.  It can also be NULL, for no normalization.
270
271The @var{resultbuf} and @var{lengthp} arguments are as described in
272chapter @ref{Conventions}.
273@end deftypefun
274
275@deftypefun {uint8_t *} u8_ct_casefold (const uint8_t *@var{s}, size_t @var{n}, casing_prefix_context_t @var{prefix_context}, casing_suffix_context_t @var{suffix_context}, const char *@var{iso639_language}, uninorm_t @var{nf}, uint8_t *@var{resultbuf}, size_t *@var{lengthp})
276@deftypefunx {uint16_t *} u16_ct_casefold (const uint16_t *@var{s}, size_t @var{n}, casing_prefix_context_t @var{prefix_context}, casing_suffix_context_t @var{suffix_context}, const char *@var{iso639_language}, uninorm_t @var{nf}, uint16_t *@var{resultbuf}, size_t *@var{lengthp})
277@deftypefunx {uint32_t *} u32_ct_casefold (const uint32_t *@var{s}, size_t @var{n}, casing_prefix_context_t @var{prefix_context}, casing_suffix_context_t @var{suffix_context}, const char *@var{iso639_language}, uninorm_t @var{nf}, uint32_t *@var{resultbuf}, size_t *@var{lengthp})
278Returns the case folded string.  The case folding takes into account the
279case mapping contexts of the prefix and suffix strings.
280
281The @var{resultbuf} and @var{lengthp} arguments are as described in
282chapter @ref{Conventions}.
283@end deftypefun
284
285@deftypefun int u8_casecmp (const uint8_t *@var{s1}, size_t @var{n1}, const uint8_t *@var{s2}, size_t @var{n2}, const char *@var{iso639_language}, uninorm_t @var{nf}, int *@var{resultp})
286@deftypefunx int u16_casecmp (const uint16_t *@var{s1}, size_t @var{n1}, const uint16_t *@var{s2}, size_t @var{n2}, const char *@var{iso639_language}, uninorm_t @var{nf}, int *@var{resultp})
287@deftypefunx int u32_casecmp (const uint32_t *@var{s1}, size_t @var{n1}, const uint32_t *@var{s2}, size_t @var{n2}, const char *@var{iso639_language}, uninorm_t @var{nf}, int *@var{resultp})
288@deftypefunx int ulc_casecmp (const char *@var{s1}, size_t @var{n1}, const char *@var{s2}, size_t @var{n2}, const char *@var{iso639_language}, uninorm_t @var{nf}, int *@var{resultp})
289Compares @var{s1} and @var{s2}, ignoring differences in case and normalization.
290
291The @var{nf} argument identifies the normalization form to apply after the
292case-mapping.  It can also be NULL, for no normalization.
293
294If successful, sets @code{*@var{resultp}} to -1 if @var{s1} < @var{s2},
2950 if @var{s1} = @var{s2}, 1 if @var{s1} > @var{s2}, and returns 0.
296Upon failure, returns -1 with @code{errno} set.
297@end deftypefun
298
299@cindex comparing, ignoring case, with collation rules
300@cindex comparing, with collation rules, ignoring case
301@cindex comparing, ignoring normalization and case, with collation rules
302@cindex comparing, with collation rules, ignoring normalization and case
303The following functions additionally take into account the sorting rules of the
304current locale.
305
306@deftypefun {char *} u8_casexfrm (const uint8_t *@var{s}, size_t @var{n}, const char *@var{iso639_language}, uninorm_t @var{nf}, char *@var{resultbuf}, size_t *@var{lengthp})
307@deftypefunx {char *} u16_casexfrm (const uint16_t *@var{s}, size_t @var{n}, const char *@var{iso639_language}, uninorm_t @var{nf}, char *@var{resultbuf}, size_t *@var{lengthp})
308@deftypefunx {char *} u32_casexfrm (const uint32_t *@var{s}, size_t @var{n}, const char *@var{iso639_language}, uninorm_t @var{nf}, char *@var{resultbuf}, size_t *@var{lengthp})
309@deftypefunx {char *} ulc_casexfrm (const char *@var{s}, size_t @var{n}, const char *@var{iso639_language}, uninorm_t @var{nf}, char *@var{resultbuf}, size_t *@var{lengthp})
310Converts the string @var{s} of length @var{n} to a NUL-terminated byte
311sequence, in such a way that comparing @code{u8_casexfrm (@var{s1})} and
312@code{u8_casexfrm (@var{s2})} with the gnulib function @code{memcmp2} is
313equivalent to comparing @var{s1} and @var{s2} with @code{u8_casecoll}.
314
315@var{nf} must be either @code{UNINORM_NFC}, @code{UNINORM_NFKC}, or NULL for
316no normalization.
317
318The @var{resultbuf} and @var{lengthp} arguments are as described in
319chapter @ref{Conventions}.
320@end deftypefun
321
322@deftypefun int u8_casecoll (const uint8_t *@var{s1}, size_t @var{n1}, const uint8_t *@var{s2}, size_t @var{n2}, const char *@var{iso639_language}, uninorm_t @var{nf}, int *@var{resultp})
323@deftypefunx int u16_casecoll (const uint16_t *@var{s1}, size_t @var{n1}, const uint16_t *@var{s2}, size_t @var{n2}, const char *@var{iso639_language}, uninorm_t @var{nf}, int *@var{resultp})
324@deftypefunx int u32_casecoll (const uint32_t *@var{s1}, size_t @var{n1}, const uint32_t *@var{s2}, size_t @var{n2}, const char *@var{iso639_language}, uninorm_t @var{nf}, int *@var{resultp})
325@deftypefunx int ulc_casecoll (const char *@var{s1}, size_t @var{n1}, const char *@var{s2}, size_t @var{n2}, const char *@var{iso639_language}, uninorm_t @var{nf}, int *@var{resultp})
326Compares @var{s1} and @var{s2}, ignoring differences in case and normalization,
327using the collation rules of the current locale.
328
329The @var{nf} argument identifies the normalization form to apply after the
330case-mapping.  It must be either @code{UNINORM_NFC} or @code{UNINORM_NFKC}.
331It can also be NULL, for no normalization.
332
333If successful, sets @code{*@var{resultp}} to -1 if @var{s1} < @var{s2},
3340 if @var{s1} = @var{s2}, 1 if @var{s1} > @var{s2}, and returns 0.
335Upon failure, returns -1 with @code{errno} set.
336@end deftypefun
337
338@node Case detection
339@section Case detection
340
341@cindex case detection
342@cindex detecting case
343The following functions determine whether a Unicode string is entirely in
344upper case. or entirely in lower case, or entirely in title case, or already
345case-folded.
346
347@deftypefun int u8_is_uppercase (const uint8_t *@var{s}, size_t @var{n}, const char *@var{iso639_language}, bool *@var{resultp})
348@deftypefunx int u16_is_uppercase (const uint16_t *@var{s}, size_t @var{n}, const char *@var{iso639_language}, bool *@var{resultp})
349@deftypefunx int u32_is_uppercase (const uint32_t *@var{s}, size_t @var{n}, const char *@var{iso639_language}, bool *@var{resultp})
350Sets @code{*@var{resultp}} to true if mapping NFD(@var{s}) to upper case is
351a no-op, or to false otherwise, and returns 0.  Upon failure, returns -1 with
352@code{errno} set.
353@end deftypefun
354
355@deftypefun int u8_is_lowercase (const uint8_t *@var{s}, size_t @var{n}, const char *@var{iso639_language}, bool *@var{resultp})
356@deftypefunx int u16_is_lowercase (const uint16_t *@var{s}, size_t @var{n}, const char *@var{iso639_language}, bool *@var{resultp})
357@deftypefunx int u32_is_lowercase (const uint32_t *@var{s}, size_t @var{n}, const char *@var{iso639_language}, bool *@var{resultp})
358Sets @code{*@var{resultp}} to true if mapping NFD(@var{s}) to lower case is
359a no-op, or to false otherwise, and returns 0.  Upon failure, returns -1 with
360@code{errno} set.
361@end deftypefun
362
363@deftypefun int u8_is_titlecase (const uint8_t *@var{s}, size_t @var{n}, const char *@var{iso639_language}, bool *@var{resultp})
364@deftypefunx int u16_is_titlecase (const uint16_t *@var{s}, size_t @var{n}, const char *@var{iso639_language}, bool *@var{resultp})
365@deftypefunx int u32_is_titlecase (const uint32_t *@var{s}, size_t @var{n}, const char *@var{iso639_language}, bool *@var{resultp})
366Sets @code{*@var{resultp}} to true if mapping NFD(@var{s}) to title case is
367a no-op, or to false otherwise, and returns 0.  Upon failure, returns -1 with
368@code{errno} set.
369@end deftypefun
370
371@deftypefun int u8_is_casefolded (const uint8_t *@var{s}, size_t @var{n}, const char *@var{iso639_language}, bool *@var{resultp})
372@deftypefunx int u16_is_casefolded (const uint16_t *@var{s}, size_t @var{n}, const char *@var{iso639_language}, bool *@var{resultp})
373@deftypefunx int u32_is_casefolded (const uint32_t *@var{s}, size_t @var{n}, const char *@var{iso639_language}, bool *@var{resultp})
374Sets @code{*@var{resultp}} to true if applying case folding to NFD(@var{S}) is
375a no-op, or to false otherwise, and returns 0.  Upon failure, returns -1 with
376@code{errno} set.
377@end deftypefun
378
379The following functions determine whether case mappings have any effect on a
380Unicode string.
381
382@deftypefun int u8_is_cased (const uint8_t *@var{s}, size_t @var{n}, const char *@var{iso639_language}, bool *@var{resultp})
383@deftypefunx int u16_is_cased (const uint16_t *@var{s}, size_t @var{n}, const char *@var{iso639_language}, bool *@var{resultp})
384@deftypefunx int u32_is_cased (const uint32_t *@var{s}, size_t @var{n}, const char *@var{iso639_language}, bool *@var{resultp})
385Sets @code{*@var{resultp}} to true if case matters for @var{s}, that is, if
386mapping NFD(@var{s}) to either upper case or lower case or title case is not
387a no-op.  Set @code{*@var{resultp}} to false if NFD(@var{s}) maps to itself
388under the upper case mapping, under the lower case mapping, and under the title
389case mapping; in other words, when NFD(@var{s}) consists entirely of caseless
390characters. Upon failure, returns -1 with @code{errno} set.
391@end deftypefun
392