Logo Search packages:      
Sourcecode: icu version File versions  Download package

U_STABLE int32_t U_EXPORT2 ucasemap_utf8ToTitle ( UCaseMap csm,
char *  dest,
int32_t  destCapacity,
const char *  src,
int32_t  srcLength,
UErrorCode pErrorCode 

Titlecase a UTF-8 string. Casing is locale-dependent and context-sensitive. Titlecasing uses a break iterator to find the first characters of words that are to be titlecased. It titlecases those characters and lowercases all others. (This can be modified with ucasemap_setOptions().)

Note: This function takes a non-const UCaseMap pointer because it will open a default break iterator if no break iterator was set yet, and effectively call ucasemap_setBreakIterator(); also because the break iterator is stateful and will be modified during the iteration.

The titlecase break iterator can be provided to customize for arbitrary styles, using rules and dictionaries beyond the standard iterators. The standard titlecase iterator for the root locale implements the algorithm of Unicode TR 21.

This function uses only the setUText(), first(), next() and close() methods of the provided break iterator.

The result may be longer or shorter than the original. The source string and the destination buffer must not overlap.

csm UCaseMap service object. This pointer is non-const! See the note above for details.
dest A buffer for the result string. The result will be NUL-terminated if the buffer is large enough. The contents is undefined in case of failure.
destCapacity The size of the buffer (number of bytes). If it is 0, then dest may be NULL and the function will only return the length of the result without writing any of the result string.
src The original string.
srcLength The length of the original string. If -1, then src must be NUL-terminated.
pErrorCode Must be a valid pointer to an error code value, which must not indicate a failure before the function call.
The length of the result string, if successful - or in case of a buffer overflow, in which case it will be greater than destCapacity.
See also:



Definition at line 553 of file ucasemap.c.

    return caseMap(csm,
                   (uint8_t *)dest, destCapacity,
                   (const uint8_t *)src, srcLength,
                   TO_TITLE, pErrorCode);

Generated by  Doxygen 1.6.0   Back to index