michael@0: /* michael@0: ********************************************************************** michael@0: * Copyright (C) 1998-2012, International Business Machines michael@0: * Corporation and others. All Rights Reserved. michael@0: ********************************************************************** michael@0: * michael@0: * File ustring.h michael@0: * michael@0: * Modification History: michael@0: * michael@0: * Date Name Description michael@0: * 12/07/98 bertrand Creation. michael@0: ****************************************************************************** michael@0: */ michael@0: michael@0: #ifndef USTRING_H michael@0: #define USTRING_H michael@0: michael@0: #include "unicode/utypes.h" michael@0: #include "unicode/putil.h" michael@0: #include "unicode/uiter.h" michael@0: michael@0: /** michael@0: * \def UBRK_TYPEDEF_UBREAK_ITERATOR michael@0: * @internal michael@0: */ michael@0: michael@0: #ifndef UBRK_TYPEDEF_UBREAK_ITERATOR michael@0: # define UBRK_TYPEDEF_UBREAK_ITERATOR michael@0: /** Simple declaration for u_strToTitle() to avoid including unicode/ubrk.h. @stable ICU 2.1*/ michael@0: typedef struct UBreakIterator UBreakIterator; michael@0: #endif michael@0: michael@0: /** michael@0: * \file michael@0: * \brief C API: Unicode string handling functions michael@0: * michael@0: * These C API functions provide general Unicode string handling. michael@0: * michael@0: * Some functions are equivalent in name, signature, and behavior to the ANSI C michael@0: * functions. (For example, they do not check for bad arguments like NULL string pointers.) michael@0: * In some cases, only the thread-safe variant of such a function is implemented here michael@0: * (see u_strtok_r()). michael@0: * michael@0: * Other functions provide more Unicode-specific functionality like locale-specific michael@0: * upper/lower-casing and string comparison in code point order. michael@0: * michael@0: * ICU uses 16-bit Unicode (UTF-16) in the form of arrays of UChar code units. michael@0: * UTF-16 encodes each Unicode code point with either one or two UChar code units. michael@0: * (This is the default form of Unicode, and a forward-compatible extension of the original, michael@0: * fixed-width form that was known as UCS-2. UTF-16 superseded UCS-2 with Unicode 2.0 michael@0: * in 1996.) michael@0: * michael@0: * Some APIs accept a 32-bit UChar32 value for a single code point. michael@0: * michael@0: * ICU also handles 16-bit Unicode text with unpaired surrogates. michael@0: * Such text is not well-formed UTF-16. michael@0: * Code-point-related functions treat unpaired surrogates as surrogate code points, michael@0: * i.e., as separate units. michael@0: * michael@0: * Although UTF-16 is a variable-width encoding form (like some legacy multi-byte encodings), michael@0: * it is much more efficient even for random access because the code unit values michael@0: * for single-unit characters vs. lead units vs. trail units are completely disjoint. michael@0: * This means that it is easy to determine character (code point) boundaries from michael@0: * random offsets in the string. michael@0: * michael@0: * Unicode (UTF-16) string processing is optimized for the single-unit case. michael@0: * Although it is important to support supplementary characters michael@0: * (which use pairs of lead/trail code units called "surrogates"), michael@0: * their occurrence is rare. Almost all characters in modern use require only michael@0: * a single UChar code unit (i.e., their code point values are <=0xffff). michael@0: * michael@0: * For more details see the User Guide Strings chapter (http://icu-project.org/userguide/strings.html). michael@0: * For a discussion of the handling of unpaired surrogates see also michael@0: * Jitterbug 2145 and its icu mailing list proposal on 2002-sep-18. michael@0: */ michael@0: michael@0: /** michael@0: * \defgroup ustring_ustrlen String Length michael@0: * \ingroup ustring_strlen michael@0: */ michael@0: /*@{*/ michael@0: /** michael@0: * Determine the length of an array of UChar. michael@0: * michael@0: * @param s The array of UChars, NULL (U+0000) terminated. michael@0: * @return The number of UChars in chars, minus the terminator. michael@0: * @stable ICU 2.0 michael@0: */ michael@0: U_STABLE int32_t U_EXPORT2 michael@0: u_strlen(const UChar *s); michael@0: /*@}*/ michael@0: michael@0: /** michael@0: * Count Unicode code points in the length UChar code units of the string. michael@0: * A code point may occupy either one or two UChar code units. michael@0: * Counting code points involves reading all code units. michael@0: * michael@0: * This functions is basically the inverse of the U16_FWD_N() macro (see utf.h). michael@0: * michael@0: * @param s The input string. michael@0: * @param length The number of UChar code units to be checked, or -1 to count all michael@0: * code points before the first NUL (U+0000). michael@0: * @return The number of code points in the specified code units. michael@0: * @stable ICU 2.0 michael@0: */ michael@0: U_STABLE int32_t U_EXPORT2 michael@0: u_countChar32(const UChar *s, int32_t length); michael@0: michael@0: /** michael@0: * Check if the string contains more Unicode code points than a certain number. michael@0: * This is more efficient than counting all code points in the entire string michael@0: * and comparing that number with a threshold. michael@0: * This function may not need to scan the string at all if the length is known michael@0: * (not -1 for NUL-termination) and falls within a certain range, and michael@0: * never needs to count more than 'number+1' code points. michael@0: * Logically equivalent to (u_countChar32(s, length)>number). michael@0: * A Unicode code point may occupy either one or two UChar code units. michael@0: * michael@0: * @param s The input string. michael@0: * @param length The length of the string, or -1 if it is NUL-terminated. michael@0: * @param number The number of code points in the string is compared against michael@0: * the 'number' parameter. michael@0: * @return Boolean value for whether the string contains more Unicode code points michael@0: * than 'number'. Same as (u_countChar32(s, length)>number). michael@0: * @stable ICU 2.4 michael@0: */ michael@0: U_STABLE UBool U_EXPORT2 michael@0: u_strHasMoreChar32Than(const UChar *s, int32_t length, int32_t number); michael@0: michael@0: /** michael@0: * Concatenate two ustrings. Appends a copy of src, michael@0: * including the null terminator, to dst. The initial copied michael@0: * character from src overwrites the null terminator in dst. michael@0: * michael@0: * @param dst The destination string. michael@0: * @param src The source string. michael@0: * @return A pointer to dst. michael@0: * @stable ICU 2.0 michael@0: */ michael@0: U_STABLE UChar* U_EXPORT2 michael@0: u_strcat(UChar *dst, michael@0: const UChar *src); michael@0: michael@0: /** michael@0: * Concatenate two ustrings. michael@0: * Appends at most n characters from src to dst. michael@0: * Adds a terminating NUL. michael@0: * If src is too long, then only n-1 characters will be copied michael@0: * before the terminating NUL. michael@0: * If n<=0 then dst is not modified. michael@0: * michael@0: * @param dst The destination string. michael@0: * @param src The source string (can be NULL/invalid if n<=0). michael@0: * @param n The maximum number of characters to append; no-op if <=0. michael@0: * @return A pointer to dst. michael@0: * @stable ICU 2.0 michael@0: */ michael@0: U_STABLE UChar* U_EXPORT2 michael@0: u_strncat(UChar *dst, michael@0: const UChar *src, michael@0: int32_t n); michael@0: michael@0: /** michael@0: * Find the first occurrence of a substring in a string. michael@0: * The substring is found at code point boundaries. michael@0: * That means that if the substring begins with michael@0: * a trail surrogate or ends with a lead surrogate, michael@0: * then it is found only if these surrogates stand alone in the text. michael@0: * Otherwise, the substring edge units would be matched against michael@0: * halves of surrogate pairs. michael@0: * michael@0: * @param s The string to search (NUL-terminated). michael@0: * @param substring The substring to find (NUL-terminated). michael@0: * @return A pointer to the first occurrence of substring in s, michael@0: * or s itself if the substring is empty, michael@0: * or NULL if substring is not in s. michael@0: * @stable ICU 2.0 michael@0: * michael@0: * @see u_strrstr michael@0: * @see u_strFindFirst michael@0: * @see u_strFindLast michael@0: */ michael@0: U_STABLE UChar * U_EXPORT2 michael@0: u_strstr(const UChar *s, const UChar *substring); michael@0: michael@0: /** michael@0: * Find the first occurrence of a substring in a string. michael@0: * The substring is found at code point boundaries. michael@0: * That means that if the substring begins with michael@0: * a trail surrogate or ends with a lead surrogate, michael@0: * then it is found only if these surrogates stand alone in the text. michael@0: * Otherwise, the substring edge units would be matched against michael@0: * halves of surrogate pairs. michael@0: * michael@0: * @param s The string to search. michael@0: * @param length The length of s (number of UChars), or -1 if it is NUL-terminated. michael@0: * @param substring The substring to find (NUL-terminated). michael@0: * @param subLength The length of substring (number of UChars), or -1 if it is NUL-terminated. michael@0: * @return A pointer to the first occurrence of substring in s, michael@0: * or s itself if the substring is empty, michael@0: * or NULL if substring is not in s. michael@0: * @stable ICU 2.4 michael@0: * michael@0: * @see u_strstr michael@0: * @see u_strFindLast michael@0: */ michael@0: U_STABLE UChar * U_EXPORT2 michael@0: u_strFindFirst(const UChar *s, int32_t length, const UChar *substring, int32_t subLength); michael@0: michael@0: /** michael@0: * Find the first occurrence of a BMP code point in a string. michael@0: * A surrogate code point is found only if its match in the text is not michael@0: * part of a surrogate pair. michael@0: * A NUL character is found at the string terminator. michael@0: * michael@0: * @param s The string to search (NUL-terminated). michael@0: * @param c The BMP code point to find. michael@0: * @return A pointer to the first occurrence of c in s michael@0: * or NULL if c is not in s. michael@0: * @stable ICU 2.0 michael@0: * michael@0: * @see u_strchr32 michael@0: * @see u_memchr michael@0: * @see u_strstr michael@0: * @see u_strFindFirst michael@0: */ michael@0: U_STABLE UChar * U_EXPORT2 michael@0: u_strchr(const UChar *s, UChar c); michael@0: michael@0: /** michael@0: * Find the first occurrence of a code point in a string. michael@0: * A surrogate code point is found only if its match in the text is not michael@0: * part of a surrogate pair. michael@0: * A NUL character is found at the string terminator. michael@0: * michael@0: * @param s The string to search (NUL-terminated). michael@0: * @param c The code point to find. michael@0: * @return A pointer to the first occurrence of c in s michael@0: * or NULL if c is not in s. michael@0: * @stable ICU 2.0 michael@0: * michael@0: * @see u_strchr michael@0: * @see u_memchr32 michael@0: * @see u_strstr michael@0: * @see u_strFindFirst michael@0: */ michael@0: U_STABLE UChar * U_EXPORT2 michael@0: u_strchr32(const UChar *s, UChar32 c); michael@0: michael@0: /** michael@0: * Find the last occurrence of a substring in a string. michael@0: * The substring is found at code point boundaries. michael@0: * That means that if the substring begins with michael@0: * a trail surrogate or ends with a lead surrogate, michael@0: * then it is found only if these surrogates stand alone in the text. michael@0: * Otherwise, the substring edge units would be matched against michael@0: * halves of surrogate pairs. michael@0: * michael@0: * @param s The string to search (NUL-terminated). michael@0: * @param substring The substring to find (NUL-terminated). michael@0: * @return A pointer to the last occurrence of substring in s, michael@0: * or s itself if the substring is empty, michael@0: * or NULL if substring is not in s. michael@0: * @stable ICU 2.4 michael@0: * michael@0: * @see u_strstr michael@0: * @see u_strFindFirst michael@0: * @see u_strFindLast michael@0: */ michael@0: U_STABLE UChar * U_EXPORT2 michael@0: u_strrstr(const UChar *s, const UChar *substring); michael@0: michael@0: /** michael@0: * Find the last occurrence of a substring in a string. michael@0: * The substring is found at code point boundaries. michael@0: * That means that if the substring begins with michael@0: * a trail surrogate or ends with a lead surrogate, michael@0: * then it is found only if these surrogates stand alone in the text. michael@0: * Otherwise, the substring edge units would be matched against michael@0: * halves of surrogate pairs. michael@0: * michael@0: * @param s The string to search. michael@0: * @param length The length of s (number of UChars), or -1 if it is NUL-terminated. michael@0: * @param substring The substring to find (NUL-terminated). michael@0: * @param subLength The length of substring (number of UChars), or -1 if it is NUL-terminated. michael@0: * @return A pointer to the last occurrence of substring in s, michael@0: * or s itself if the substring is empty, michael@0: * or NULL if substring is not in s. michael@0: * @stable ICU 2.4 michael@0: * michael@0: * @see u_strstr michael@0: * @see u_strFindLast michael@0: */ michael@0: U_STABLE UChar * U_EXPORT2 michael@0: u_strFindLast(const UChar *s, int32_t length, const UChar *substring, int32_t subLength); michael@0: michael@0: /** michael@0: * Find the last occurrence of a BMP code point in a string. michael@0: * A surrogate code point is found only if its match in the text is not michael@0: * part of a surrogate pair. michael@0: * A NUL character is found at the string terminator. michael@0: * michael@0: * @param s The string to search (NUL-terminated). michael@0: * @param c The BMP code point to find. michael@0: * @return A pointer to the last occurrence of c in s michael@0: * or NULL if c is not in s. michael@0: * @stable ICU 2.4 michael@0: * michael@0: * @see u_strrchr32 michael@0: * @see u_memrchr michael@0: * @see u_strrstr michael@0: * @see u_strFindLast michael@0: */ michael@0: U_STABLE UChar * U_EXPORT2 michael@0: u_strrchr(const UChar *s, UChar c); michael@0: michael@0: /** michael@0: * Find the last occurrence of a code point in a string. michael@0: * A surrogate code point is found only if its match in the text is not michael@0: * part of a surrogate pair. michael@0: * A NUL character is found at the string terminator. michael@0: * michael@0: * @param s The string to search (NUL-terminated). michael@0: * @param c The code point to find. michael@0: * @return A pointer to the last occurrence of c in s michael@0: * or NULL if c is not in s. michael@0: * @stable ICU 2.4 michael@0: * michael@0: * @see u_strrchr michael@0: * @see u_memchr32 michael@0: * @see u_strrstr michael@0: * @see u_strFindLast michael@0: */ michael@0: U_STABLE UChar * U_EXPORT2 michael@0: u_strrchr32(const UChar *s, UChar32 c); michael@0: michael@0: /** michael@0: * Locates the first occurrence in the string string of any of the characters michael@0: * in the string matchSet. michael@0: * Works just like C's strpbrk but with Unicode. michael@0: * michael@0: * @param string The string in which to search, NUL-terminated. michael@0: * @param matchSet A NUL-terminated string defining a set of code points michael@0: * for which to search in the text string. michael@0: * @return A pointer to the character in string that matches one of the michael@0: * characters in matchSet, or NULL if no such character is found. michael@0: * @stable ICU 2.0 michael@0: */ michael@0: U_STABLE UChar * U_EXPORT2 michael@0: u_strpbrk(const UChar *string, const UChar *matchSet); michael@0: michael@0: /** michael@0: * Returns the number of consecutive characters in string, michael@0: * beginning with the first, that do not occur somewhere in matchSet. michael@0: * Works just like C's strcspn but with Unicode. michael@0: * michael@0: * @param string The string in which to search, NUL-terminated. michael@0: * @param matchSet A NUL-terminated string defining a set of code points michael@0: * for which to search in the text string. michael@0: * @return The number of initial characters in string that do not michael@0: * occur in matchSet. michael@0: * @see u_strspn michael@0: * @stable ICU 2.0 michael@0: */ michael@0: U_STABLE int32_t U_EXPORT2 michael@0: u_strcspn(const UChar *string, const UChar *matchSet); michael@0: michael@0: /** michael@0: * Returns the number of consecutive characters in string, michael@0: * beginning with the first, that occur somewhere in matchSet. michael@0: * Works just like C's strspn but with Unicode. michael@0: * michael@0: * @param string The string in which to search, NUL-terminated. michael@0: * @param matchSet A NUL-terminated string defining a set of code points michael@0: * for which to search in the text string. michael@0: * @return The number of initial characters in string that do michael@0: * occur in matchSet. michael@0: * @see u_strcspn michael@0: * @stable ICU 2.0 michael@0: */ michael@0: U_STABLE int32_t U_EXPORT2 michael@0: u_strspn(const UChar *string, const UChar *matchSet); michael@0: michael@0: /** michael@0: * The string tokenizer API allows an application to break a string into michael@0: * tokens. Unlike strtok(), the saveState (the current pointer within the michael@0: * original string) is maintained in saveState. In the first call, the michael@0: * argument src is a pointer to the string. In subsequent calls to michael@0: * return successive tokens of that string, src must be specified as michael@0: * NULL. The value saveState is set by this function to maintain the michael@0: * function's position within the string, and on each subsequent call michael@0: * you must give this argument the same variable. This function does michael@0: * handle surrogate pairs. This function is similar to the strtok_r() michael@0: * the POSIX Threads Extension (1003.1c-1995) version. michael@0: * michael@0: * @param src String containing token(s). This string will be modified. michael@0: * After the first call to u_strtok_r(), this argument must michael@0: * be NULL to get to the next token. michael@0: * @param delim Set of delimiter characters (Unicode code points). michael@0: * @param saveState The current pointer within the original string, michael@0: * which is set by this function. The saveState michael@0: * parameter should the address of a local variable of type michael@0: * UChar *. (i.e. defined "Uhar *myLocalSaveState" and use michael@0: * &myLocalSaveState for this parameter). michael@0: * @return A pointer to the next token found in src, or NULL michael@0: * when there are no more tokens. michael@0: * @stable ICU 2.0 michael@0: */ michael@0: U_STABLE UChar * U_EXPORT2 michael@0: u_strtok_r(UChar *src, michael@0: const UChar *delim, michael@0: UChar **saveState); michael@0: michael@0: /** michael@0: * Compare two Unicode strings for bitwise equality (code unit order). michael@0: * michael@0: * @param s1 A string to compare. michael@0: * @param s2 A string to compare. michael@0: * @return 0 if s1 and s2 are bitwise equal; a negative michael@0: * value if s1 is bitwise less than s2,; a positive michael@0: * value if s1 is bitwise greater than s2. michael@0: * @stable ICU 2.0 michael@0: */ michael@0: U_STABLE int32_t U_EXPORT2 michael@0: u_strcmp(const UChar *s1, michael@0: const UChar *s2); michael@0: michael@0: /** michael@0: * Compare two Unicode strings in code point order. michael@0: * See u_strCompare for details. michael@0: * michael@0: * @param s1 A string to compare. michael@0: * @param s2 A string to compare. michael@0: * @return a negative/zero/positive integer corresponding to whether michael@0: * the first string is less than/equal to/greater than the second one michael@0: * in code point order michael@0: * @stable ICU 2.0 michael@0: */ michael@0: U_STABLE int32_t U_EXPORT2 michael@0: u_strcmpCodePointOrder(const UChar *s1, const UChar *s2); michael@0: michael@0: /** michael@0: * Compare two Unicode strings (binary order). michael@0: * michael@0: * The comparison can be done in code unit order or in code point order. michael@0: * They differ only in UTF-16 when michael@0: * comparing supplementary code points (U+10000..U+10ffff) michael@0: * to BMP code points near the end of the BMP (i.e., U+e000..U+ffff). michael@0: * In code unit order, high BMP code points sort after supplementary code points michael@0: * because they are stored as pairs of surrogates which are at U+d800..U+dfff. michael@0: * michael@0: * This functions works with strings of different explicitly specified lengths michael@0: * unlike the ANSI C-like u_strcmp() and u_memcmp() etc. michael@0: * NUL-terminated strings are possible with length arguments of -1. michael@0: * michael@0: * @param s1 First source string. michael@0: * @param length1 Length of first source string, or -1 if NUL-terminated. michael@0: * michael@0: * @param s2 Second source string. michael@0: * @param length2 Length of second source string, or -1 if NUL-terminated. michael@0: * michael@0: * @param codePointOrder Choose between code unit order (FALSE) michael@0: * and code point order (TRUE). michael@0: * michael@0: * @return <0 or 0 or >0 as usual for string comparisons michael@0: * michael@0: * @stable ICU 2.2 michael@0: */ michael@0: U_STABLE int32_t U_EXPORT2 michael@0: u_strCompare(const UChar *s1, int32_t length1, michael@0: const UChar *s2, int32_t length2, michael@0: UBool codePointOrder); michael@0: michael@0: /** michael@0: * Compare two Unicode strings (binary order) michael@0: * as presented by UCharIterator objects. michael@0: * Works otherwise just like u_strCompare(). michael@0: * michael@0: * Both iterators are reset to their start positions. michael@0: * When the function returns, it is undefined where the iterators michael@0: * have stopped. michael@0: * michael@0: * @param iter1 First source string iterator. michael@0: * @param iter2 Second source string iterator. michael@0: * @param codePointOrder Choose between code unit order (FALSE) michael@0: * and code point order (TRUE). michael@0: * michael@0: * @return <0 or 0 or >0 as usual for string comparisons michael@0: * michael@0: * @see u_strCompare michael@0: * michael@0: * @stable ICU 2.6 michael@0: */ michael@0: U_STABLE int32_t U_EXPORT2 michael@0: u_strCompareIter(UCharIterator *iter1, UCharIterator *iter2, UBool codePointOrder); michael@0: michael@0: #ifndef U_COMPARE_CODE_POINT_ORDER michael@0: /* see also unistr.h and unorm.h */ michael@0: /** michael@0: * Option bit for u_strCaseCompare, u_strcasecmp, unorm_compare, etc: michael@0: * Compare strings in code point order instead of code unit order. michael@0: * @stable ICU 2.2 michael@0: */ michael@0: #define U_COMPARE_CODE_POINT_ORDER 0x8000 michael@0: #endif michael@0: michael@0: /** michael@0: * Compare two strings case-insensitively using full case folding. michael@0: * This is equivalent to michael@0: * u_strCompare(u_strFoldCase(s1, options), michael@0: * u_strFoldCase(s2, options), michael@0: * (options&U_COMPARE_CODE_POINT_ORDER)!=0). michael@0: * michael@0: * The comparison can be done in UTF-16 code unit order or in code point order. michael@0: * They differ only when comparing supplementary code points (U+10000..U+10ffff) michael@0: * to BMP code points near the end of the BMP (i.e., U+e000..U+ffff). michael@0: * In code unit order, high BMP code points sort after supplementary code points michael@0: * because they are stored as pairs of surrogates which are at U+d800..U+dfff. michael@0: * michael@0: * This functions works with strings of different explicitly specified lengths michael@0: * unlike the ANSI C-like u_strcmp() and u_memcmp() etc. michael@0: * NUL-terminated strings are possible with length arguments of -1. michael@0: * michael@0: * @param s1 First source string. michael@0: * @param length1 Length of first source string, or -1 if NUL-terminated. michael@0: * michael@0: * @param s2 Second source string. michael@0: * @param length2 Length of second source string, or -1 if NUL-terminated. michael@0: * michael@0: * @param options A bit set of options: michael@0: * - U_FOLD_CASE_DEFAULT or 0 is used for default options: michael@0: * Comparison in code unit order with default case folding. michael@0: * michael@0: * - U_COMPARE_CODE_POINT_ORDER michael@0: * Set to choose code point order instead of code unit order michael@0: * (see u_strCompare for details). michael@0: * michael@0: * - U_FOLD_CASE_EXCLUDE_SPECIAL_I michael@0: * michael@0: * @param pErrorCode Must be a valid pointer to an error code value, michael@0: * which must not indicate a failure before the function call. michael@0: * michael@0: * @return <0 or 0 or >0 as usual for string comparisons michael@0: * michael@0: * @stable ICU 2.2 michael@0: */ michael@0: U_STABLE int32_t U_EXPORT2 michael@0: u_strCaseCompare(const UChar *s1, int32_t length1, michael@0: const UChar *s2, int32_t length2, michael@0: uint32_t options, michael@0: UErrorCode *pErrorCode); michael@0: michael@0: /** michael@0: * Compare two ustrings for bitwise equality. michael@0: * Compares at most n characters. michael@0: * michael@0: * @param ucs1 A string to compare (can be NULL/invalid if n<=0). michael@0: * @param ucs2 A string to compare (can be NULL/invalid if n<=0). michael@0: * @param n The maximum number of characters to compare; always returns 0 if n<=0. michael@0: * @return 0 if s1 and s2 are bitwise equal; a negative michael@0: * value if s1 is bitwise less than s2; a positive michael@0: * value if s1 is bitwise greater than s2. michael@0: * @stable ICU 2.0 michael@0: */ michael@0: U_STABLE int32_t U_EXPORT2 michael@0: u_strncmp(const UChar *ucs1, michael@0: const UChar *ucs2, michael@0: int32_t n); michael@0: michael@0: /** michael@0: * Compare two Unicode strings in code point order. michael@0: * This is different in UTF-16 from u_strncmp() if supplementary characters are present. michael@0: * For details, see u_strCompare(). michael@0: * michael@0: * @param s1 A string to compare. michael@0: * @param s2 A string to compare. michael@0: * @param n The maximum number of characters to compare. michael@0: * @return a negative/zero/positive integer corresponding to whether michael@0: * the first string is less than/equal to/greater than the second one michael@0: * in code point order michael@0: * @stable ICU 2.0 michael@0: */ michael@0: U_STABLE int32_t U_EXPORT2 michael@0: u_strncmpCodePointOrder(const UChar *s1, const UChar *s2, int32_t n); michael@0: michael@0: /** michael@0: * Compare two strings case-insensitively using full case folding. michael@0: * This is equivalent to u_strcmp(u_strFoldCase(s1, options), u_strFoldCase(s2, options)). michael@0: * michael@0: * @param s1 A string to compare. michael@0: * @param s2 A string to compare. michael@0: * @param options A bit set of options: michael@0: * - U_FOLD_CASE_DEFAULT or 0 is used for default options: michael@0: * Comparison in code unit order with default case folding. michael@0: * michael@0: * - U_COMPARE_CODE_POINT_ORDER michael@0: * Set to choose code point order instead of code unit order michael@0: * (see u_strCompare for details). michael@0: * michael@0: * - U_FOLD_CASE_EXCLUDE_SPECIAL_I michael@0: * michael@0: * @return A negative, zero, or positive integer indicating the comparison result. michael@0: * @stable ICU 2.0 michael@0: */ michael@0: U_STABLE int32_t U_EXPORT2 michael@0: u_strcasecmp(const UChar *s1, const UChar *s2, uint32_t options); michael@0: michael@0: /** michael@0: * Compare two strings case-insensitively using full case folding. michael@0: * This is equivalent to u_strcmp(u_strFoldCase(s1, at most n, options), michael@0: * u_strFoldCase(s2, at most n, options)). michael@0: * michael@0: * @param s1 A string to compare. michael@0: * @param s2 A string to compare. michael@0: * @param n The maximum number of characters each string to case-fold and then compare. michael@0: * @param options A bit set of options: michael@0: * - U_FOLD_CASE_DEFAULT or 0 is used for default options: michael@0: * Comparison in code unit order with default case folding. michael@0: * michael@0: * - U_COMPARE_CODE_POINT_ORDER michael@0: * Set to choose code point order instead of code unit order michael@0: * (see u_strCompare for details). michael@0: * michael@0: * - U_FOLD_CASE_EXCLUDE_SPECIAL_I michael@0: * michael@0: * @return A negative, zero, or positive integer indicating the comparison result. michael@0: * @stable ICU 2.0 michael@0: */ michael@0: U_STABLE int32_t U_EXPORT2 michael@0: u_strncasecmp(const UChar *s1, const UChar *s2, int32_t n, uint32_t options); michael@0: michael@0: /** michael@0: * Compare two strings case-insensitively using full case folding. michael@0: * This is equivalent to u_strcmp(u_strFoldCase(s1, n, options), michael@0: * u_strFoldCase(s2, n, options)). michael@0: * michael@0: * @param s1 A string to compare. michael@0: * @param s2 A string to compare. michael@0: * @param length The number of characters in each string to case-fold and then compare. michael@0: * @param options A bit set of options: michael@0: * - U_FOLD_CASE_DEFAULT or 0 is used for default options: michael@0: * Comparison in code unit order with default case folding. michael@0: * michael@0: * - U_COMPARE_CODE_POINT_ORDER michael@0: * Set to choose code point order instead of code unit order michael@0: * (see u_strCompare for details). michael@0: * michael@0: * - U_FOLD_CASE_EXCLUDE_SPECIAL_I michael@0: * michael@0: * @return A negative, zero, or positive integer indicating the comparison result. michael@0: * @stable ICU 2.0 michael@0: */ michael@0: U_STABLE int32_t U_EXPORT2 michael@0: u_memcasecmp(const UChar *s1, const UChar *s2, int32_t length, uint32_t options); michael@0: michael@0: /** michael@0: * Copy a ustring. Adds a null terminator. michael@0: * michael@0: * @param dst The destination string. michael@0: * @param src The source string. michael@0: * @return A pointer to dst. michael@0: * @stable ICU 2.0 michael@0: */ michael@0: U_STABLE UChar* U_EXPORT2 michael@0: u_strcpy(UChar *dst, michael@0: const UChar *src); michael@0: michael@0: /** michael@0: * Copy a ustring. michael@0: * Copies at most n characters. The result will be null terminated michael@0: * if the length of src is less than n. michael@0: * michael@0: * @param dst The destination string. michael@0: * @param src The source string (can be NULL/invalid if n<=0). michael@0: * @param n The maximum number of characters to copy; no-op if <=0. michael@0: * @return A pointer to dst. michael@0: * @stable ICU 2.0 michael@0: */ michael@0: U_STABLE UChar* U_EXPORT2 michael@0: u_strncpy(UChar *dst, michael@0: const UChar *src, michael@0: int32_t n); michael@0: michael@0: #if !UCONFIG_NO_CONVERSION michael@0: michael@0: /** michael@0: * Copy a byte string encoded in the default codepage to a ustring. michael@0: * Adds a null terminator. michael@0: * Performs a host byte to UChar conversion michael@0: * michael@0: * @param dst The destination string. michael@0: * @param src The source string. michael@0: * @return A pointer to dst. michael@0: * @stable ICU 2.0 michael@0: */ michael@0: U_STABLE UChar* U_EXPORT2 u_uastrcpy(UChar *dst, michael@0: const char *src ); michael@0: michael@0: /** michael@0: * Copy a byte string encoded in the default codepage to a ustring. michael@0: * Copies at most n characters. The result will be null terminated michael@0: * if the length of src is less than n. michael@0: * Performs a host byte to UChar conversion michael@0: * michael@0: * @param dst The destination string. michael@0: * @param src The source string. michael@0: * @param n The maximum number of characters to copy. michael@0: * @return A pointer to dst. michael@0: * @stable ICU 2.0 michael@0: */ michael@0: U_STABLE UChar* U_EXPORT2 u_uastrncpy(UChar *dst, michael@0: const char *src, michael@0: int32_t n); michael@0: michael@0: /** michael@0: * Copy ustring to a byte string encoded in the default codepage. michael@0: * Adds a null terminator. michael@0: * Performs a UChar to host byte conversion michael@0: * michael@0: * @param dst The destination string. michael@0: * @param src The source string. michael@0: * @return A pointer to dst. michael@0: * @stable ICU 2.0 michael@0: */ michael@0: U_STABLE char* U_EXPORT2 u_austrcpy(char *dst, michael@0: const UChar *src ); michael@0: michael@0: /** michael@0: * Copy ustring to a byte string encoded in the default codepage. michael@0: * Copies at most n characters. The result will be null terminated michael@0: * if the length of src is less than n. michael@0: * Performs a UChar to host byte conversion michael@0: * michael@0: * @param dst The destination string. michael@0: * @param src The source string. michael@0: * @param n The maximum number of characters to copy. michael@0: * @return A pointer to dst. michael@0: * @stable ICU 2.0 michael@0: */ michael@0: U_STABLE char* U_EXPORT2 u_austrncpy(char *dst, michael@0: const UChar *src, michael@0: int32_t n ); michael@0: michael@0: #endif michael@0: michael@0: /** michael@0: * Synonym for memcpy(), but with UChars only. michael@0: * @param dest The destination string michael@0: * @param src The source string (can be NULL/invalid if count<=0) michael@0: * @param count The number of characters to copy; no-op if <=0 michael@0: * @return A pointer to dest michael@0: * @stable ICU 2.0 michael@0: */ michael@0: U_STABLE UChar* U_EXPORT2 michael@0: u_memcpy(UChar *dest, const UChar *src, int32_t count); michael@0: michael@0: /** michael@0: * Synonym for memmove(), but with UChars only. michael@0: * @param dest The destination string michael@0: * @param src The source string (can be NULL/invalid if count<=0) michael@0: * @param count The number of characters to move; no-op if <=0 michael@0: * @return A pointer to dest michael@0: * @stable ICU 2.0 michael@0: */ michael@0: U_STABLE UChar* U_EXPORT2 michael@0: u_memmove(UChar *dest, const UChar *src, int32_t count); michael@0: michael@0: /** michael@0: * Initialize count characters of dest to c. michael@0: * michael@0: * @param dest The destination string. michael@0: * @param c The character to initialize the string. michael@0: * @param count The maximum number of characters to set. michael@0: * @return A pointer to dest. michael@0: * @stable ICU 2.0 michael@0: */ michael@0: U_STABLE UChar* U_EXPORT2 michael@0: u_memset(UChar *dest, UChar c, int32_t count); michael@0: michael@0: /** michael@0: * Compare the first count UChars of each buffer. michael@0: * michael@0: * @param buf1 The first string to compare. michael@0: * @param buf2 The second string to compare. michael@0: * @param count The maximum number of UChars to compare. michael@0: * @return When buf1 < buf2, a negative number is returned. michael@0: * When buf1 == buf2, 0 is returned. michael@0: * When buf1 > buf2, a positive number is returned. michael@0: * @stable ICU 2.0 michael@0: */ michael@0: U_STABLE int32_t U_EXPORT2 michael@0: u_memcmp(const UChar *buf1, const UChar *buf2, int32_t count); michael@0: michael@0: /** michael@0: * Compare two Unicode strings in code point order. michael@0: * This is different in UTF-16 from u_memcmp() if supplementary characters are present. michael@0: * For details, see u_strCompare(). michael@0: * michael@0: * @param s1 A string to compare. michael@0: * @param s2 A string to compare. michael@0: * @param count The maximum number of characters to compare. michael@0: * @return a negative/zero/positive integer corresponding to whether michael@0: * the first string is less than/equal to/greater than the second one michael@0: * in code point order michael@0: * @stable ICU 2.0 michael@0: */ michael@0: U_STABLE int32_t U_EXPORT2 michael@0: u_memcmpCodePointOrder(const UChar *s1, const UChar *s2, int32_t count); michael@0: michael@0: /** michael@0: * Find the first occurrence of a BMP code point in a string. michael@0: * A surrogate code point is found only if its match in the text is not michael@0: * part of a surrogate pair. michael@0: * A NUL character is found at the string terminator. michael@0: * michael@0: * @param s The string to search (contains count UChars). michael@0: * @param c The BMP code point to find. michael@0: * @param count The length of the string. michael@0: * @return A pointer to the first occurrence of c in s michael@0: * or NULL if c is not in s. michael@0: * @stable ICU 2.0 michael@0: * michael@0: * @see u_strchr michael@0: * @see u_memchr32 michael@0: * @see u_strFindFirst michael@0: */ michael@0: U_STABLE UChar* U_EXPORT2 michael@0: u_memchr(const UChar *s, UChar c, int32_t count); michael@0: michael@0: /** michael@0: * Find the first occurrence of a code point in a string. michael@0: * A surrogate code point is found only if its match in the text is not michael@0: * part of a surrogate pair. michael@0: * A NUL character is found at the string terminator. michael@0: * michael@0: * @param s The string to search (contains count UChars). michael@0: * @param c The code point to find. michael@0: * @param count The length of the string. michael@0: * @return A pointer to the first occurrence of c in s michael@0: * or NULL if c is not in s. michael@0: * @stable ICU 2.0 michael@0: * michael@0: * @see u_strchr32 michael@0: * @see u_memchr michael@0: * @see u_strFindFirst michael@0: */ michael@0: U_STABLE UChar* U_EXPORT2 michael@0: u_memchr32(const UChar *s, UChar32 c, int32_t count); michael@0: michael@0: /** michael@0: * Find the last occurrence of a BMP code point in a string. michael@0: * A surrogate code point is found only if its match in the text is not michael@0: * part of a surrogate pair. michael@0: * A NUL character is found at the string terminator. michael@0: * michael@0: * @param s The string to search (contains count UChars). michael@0: * @param c The BMP code point to find. michael@0: * @param count The length of the string. michael@0: * @return A pointer to the last occurrence of c in s michael@0: * or NULL if c is not in s. michael@0: * @stable ICU 2.4 michael@0: * michael@0: * @see u_strrchr michael@0: * @see u_memrchr32 michael@0: * @see u_strFindLast michael@0: */ michael@0: U_STABLE UChar* U_EXPORT2 michael@0: u_memrchr(const UChar *s, UChar c, int32_t count); michael@0: michael@0: /** michael@0: * Find the last occurrence of a code point in a string. michael@0: * A surrogate code point is found only if its match in the text is not michael@0: * part of a surrogate pair. michael@0: * A NUL character is found at the string terminator. michael@0: * michael@0: * @param s The string to search (contains count UChars). michael@0: * @param c The code point to find. michael@0: * @param count The length of the string. michael@0: * @return A pointer to the last occurrence of c in s michael@0: * or NULL if c is not in s. michael@0: * @stable ICU 2.4 michael@0: * michael@0: * @see u_strrchr32 michael@0: * @see u_memrchr michael@0: * @see u_strFindLast michael@0: */ michael@0: U_STABLE UChar* U_EXPORT2 michael@0: u_memrchr32(const UChar *s, UChar32 c, int32_t count); michael@0: michael@0: /** michael@0: * Unicode String literals in C. michael@0: * We need one macro to declare a variable for the string michael@0: * and to statically preinitialize it if possible, michael@0: * and a second macro to dynamically intialize such a string variable if necessary. michael@0: * michael@0: * The macros are defined for maximum performance. michael@0: * They work only for strings that contain "invariant characters", i.e., michael@0: * only latin letters, digits, and some punctuation. michael@0: * See utypes.h for details. michael@0: * michael@0: * A pair of macros for a single string must be used with the same michael@0: * parameters. michael@0: * The string parameter must be a C string literal. michael@0: * The length of the string, not including the terminating michael@0: * NUL, must be specified as a constant. michael@0: * The U_STRING_DECL macro should be invoked exactly once for one michael@0: * such string variable before it is used. michael@0: * michael@0: * Usage: michael@0: *
michael@0:  *    U_STRING_DECL(ustringVar1, "Quick-Fox 2", 11);
michael@0:  *    U_STRING_DECL(ustringVar2, "jumps 5%", 8);
michael@0:  *    static UBool didInit=FALSE;
michael@0:  * 
michael@0:  *    int32_t function() {
michael@0:  *        if(!didInit) {
michael@0:  *            U_STRING_INIT(ustringVar1, "Quick-Fox 2", 11);
michael@0:  *            U_STRING_INIT(ustringVar2, "jumps 5%", 8);
michael@0:  *            didInit=TRUE;
michael@0:  *        }
michael@0:  *        return u_strcmp(ustringVar1, ustringVar2);
michael@0:  *    }
michael@0:  * 
michael@0: * michael@0: * Note that the macros will NOT consistently work if their argument is another #define. michael@0: * The following will not work on all platforms, don't use it. michael@0: * michael@0: *
michael@0:  *     #define GLUCK "Mr. Gluck"
michael@0:  *     U_STRING_DECL(var, GLUCK, 9)
michael@0:  *     U_STRING_INIT(var, GLUCK, 9)
michael@0:  * 
michael@0: * michael@0: * Instead, use the string literal "Mr. Gluck" as the argument to both macro michael@0: * calls. michael@0: * michael@0: * michael@0: * @stable ICU 2.0 michael@0: */ michael@0: #if defined(U_DECLARE_UTF16) michael@0: # define U_STRING_DECL(var, cs, length) static const UChar *var=(const UChar *)U_DECLARE_UTF16(cs) michael@0: /**@stable ICU 2.0 */ michael@0: # define U_STRING_INIT(var, cs, length) michael@0: #elif U_SIZEOF_WCHAR_T==U_SIZEOF_UCHAR && (U_CHARSET_FAMILY==U_ASCII_FAMILY || (U_SIZEOF_UCHAR == 2 && defined(U_WCHAR_IS_UTF16))) michael@0: # define U_STRING_DECL(var, cs, length) static const UChar var[(length)+1]=L ## cs michael@0: /**@stable ICU 2.0 */ michael@0: # define U_STRING_INIT(var, cs, length) michael@0: #elif U_SIZEOF_UCHAR==1 && U_CHARSET_FAMILY==U_ASCII_FAMILY michael@0: # define U_STRING_DECL(var, cs, length) static const UChar var[(length)+1]=cs michael@0: /**@stable ICU 2.0 */ michael@0: # define U_STRING_INIT(var, cs, length) michael@0: #else michael@0: # define U_STRING_DECL(var, cs, length) static UChar var[(length)+1] michael@0: /**@stable ICU 2.0 */ michael@0: # define U_STRING_INIT(var, cs, length) u_charsToUChars(cs, var, length+1) michael@0: #endif michael@0: michael@0: /** michael@0: * Unescape a string of characters and write the resulting michael@0: * Unicode characters to the destination buffer. The following escape michael@0: * sequences are recognized: michael@0: * michael@0: * \\uhhhh 4 hex digits; h in [0-9A-Fa-f] michael@0: * \\Uhhhhhhhh 8 hex digits michael@0: * \\xhh 1-2 hex digits michael@0: * \\x{h...} 1-8 hex digits michael@0: * \\ooo 1-3 octal digits; o in [0-7] michael@0: * \\cX control-X; X is masked with 0x1F michael@0: * michael@0: * as well as the standard ANSI C escapes: michael@0: * michael@0: * \\a => U+0007, \\b => U+0008, \\t => U+0009, \\n => U+000A, michael@0: * \\v => U+000B, \\f => U+000C, \\r => U+000D, \\e => U+001B, michael@0: * \\" => U+0022, \\' => U+0027, \\? => U+003F, \\\\ => U+005C michael@0: * michael@0: * Anything else following a backslash is generically escaped. For michael@0: * example, "[a\\-z]" returns "[a-z]". michael@0: * michael@0: * If an escape sequence is ill-formed, this method returns an empty michael@0: * string. An example of an ill-formed sequence is "\\u" followed by michael@0: * fewer than 4 hex digits. michael@0: * michael@0: * The above characters are recognized in the compiler's codepage, michael@0: * that is, they are coded as 'u', '\\', etc. Characters that are michael@0: * not parts of escape sequences are converted using u_charsToUChars(). michael@0: * michael@0: * This function is similar to UnicodeString::unescape() but not michael@0: * identical to it. The latter takes a source UnicodeString, so it michael@0: * does escape recognition but no conversion. michael@0: * michael@0: * @param src a zero-terminated string of invariant characters michael@0: * @param dest pointer to buffer to receive converted and unescaped michael@0: * text and, if there is room, a zero terminator. May be NULL for michael@0: * preflighting, in which case no UChars will be written, but the michael@0: * return value will still be valid. On error, an empty string is michael@0: * stored here (if possible). michael@0: * @param destCapacity the number of UChars that may be written at michael@0: * dest. Ignored if dest == NULL. michael@0: * @return the length of unescaped string. michael@0: * @see u_unescapeAt michael@0: * @see UnicodeString#unescape() michael@0: * @see UnicodeString#unescapeAt() michael@0: * @stable ICU 2.0 michael@0: */ michael@0: U_STABLE int32_t U_EXPORT2 michael@0: u_unescape(const char *src, michael@0: UChar *dest, int32_t destCapacity); michael@0: michael@0: U_CDECL_BEGIN michael@0: /** michael@0: * Callback function for u_unescapeAt() that returns a character of michael@0: * the source text given an offset and a context pointer. The context michael@0: * pointer will be whatever is passed into u_unescapeAt(). michael@0: * michael@0: * @param offset pointer to the offset that will be passed to u_unescapeAt(). michael@0: * @param context an opaque pointer passed directly into u_unescapeAt() michael@0: * @return the character represented by the escape sequence at michael@0: * offset michael@0: * @see u_unescapeAt michael@0: * @stable ICU 2.0 michael@0: */ michael@0: typedef UChar (U_CALLCONV *UNESCAPE_CHAR_AT)(int32_t offset, void *context); michael@0: U_CDECL_END michael@0: michael@0: /** michael@0: * Unescape a single sequence. The character at offset-1 is assumed michael@0: * (without checking) to be a backslash. This method takes a callback michael@0: * pointer to a function that returns the UChar at a given offset. By michael@0: * varying this callback, ICU functions are able to unescape char* michael@0: * strings, UnicodeString objects, and UFILE pointers. michael@0: * michael@0: * If offset is out of range, or if the escape sequence is ill-formed, michael@0: * (UChar32)0xFFFFFFFF is returned. See documentation of u_unescape() michael@0: * for a list of recognized sequences. michael@0: * michael@0: * @param charAt callback function that returns a UChar of the source michael@0: * text given an offset and a context pointer. michael@0: * @param offset pointer to the offset that will be passed to charAt. michael@0: * The offset value will be updated upon return to point after the michael@0: * last parsed character of the escape sequence. On error the offset michael@0: * is unchanged. michael@0: * @param length the number of characters in the source text. The michael@0: * last character of the source text is considered to be at offset michael@0: * length-1. michael@0: * @param context an opaque pointer passed directly into charAt. michael@0: * @return the character represented by the escape sequence at michael@0: * offset, or (UChar32)0xFFFFFFFF on error. michael@0: * @see u_unescape() michael@0: * @see UnicodeString#unescape() michael@0: * @see UnicodeString#unescapeAt() michael@0: * @stable ICU 2.0 michael@0: */ michael@0: U_STABLE UChar32 U_EXPORT2 michael@0: u_unescapeAt(UNESCAPE_CHAR_AT charAt, michael@0: int32_t *offset, michael@0: int32_t length, michael@0: void *context); michael@0: michael@0: /** michael@0: * Uppercase the characters in a string. michael@0: * Casing is locale-dependent and context-sensitive. michael@0: * The result may be longer or shorter than the original. michael@0: * The source string and the destination buffer are allowed to overlap. michael@0: * michael@0: * @param dest A buffer for the result string. The result will be zero-terminated if michael@0: * the buffer is large enough. michael@0: * @param destCapacity The size of the buffer (number of UChars). If it is 0, then michael@0: * dest may be NULL and the function will only return the length of the result michael@0: * without writing any of the result string. michael@0: * @param src The original string michael@0: * @param srcLength The length of the original string. If -1, then src must be zero-terminated. michael@0: * @param locale The locale to consider, or "" for the root locale or NULL for the default locale. michael@0: * @param pErrorCode Must be a valid pointer to an error code value, michael@0: * which must not indicate a failure before the function call. michael@0: * @return The length of the result string. It may be greater than destCapacity. In that case, michael@0: * only some of the result was written to the destination buffer. michael@0: * @stable ICU 2.0 michael@0: */ michael@0: U_STABLE int32_t U_EXPORT2 michael@0: u_strToUpper(UChar *dest, int32_t destCapacity, michael@0: const UChar *src, int32_t srcLength, michael@0: const char *locale, michael@0: UErrorCode *pErrorCode); michael@0: michael@0: /** michael@0: * Lowercase the characters in a string. michael@0: * Casing is locale-dependent and context-sensitive. michael@0: * The result may be longer or shorter than the original. michael@0: * The source string and the destination buffer are allowed to overlap. michael@0: * michael@0: * @param dest A buffer for the result string. The result will be zero-terminated if michael@0: * the buffer is large enough. michael@0: * @param destCapacity The size of the buffer (number of UChars). If it is 0, then michael@0: * dest may be NULL and the function will only return the length of the result michael@0: * without writing any of the result string. michael@0: * @param src The original string michael@0: * @param srcLength The length of the original string. If -1, then src must be zero-terminated. michael@0: * @param locale The locale to consider, or "" for the root locale or NULL for the default locale. michael@0: * @param pErrorCode Must be a valid pointer to an error code value, michael@0: * which must not indicate a failure before the function call. michael@0: * @return The length of the result string. It may be greater than destCapacity. In that case, michael@0: * only some of the result was written to the destination buffer. michael@0: * @stable ICU 2.0 michael@0: */ michael@0: U_STABLE int32_t U_EXPORT2 michael@0: u_strToLower(UChar *dest, int32_t destCapacity, michael@0: const UChar *src, int32_t srcLength, michael@0: const char *locale, michael@0: UErrorCode *pErrorCode); michael@0: michael@0: #if !UCONFIG_NO_BREAK_ITERATION michael@0: michael@0: /** michael@0: * Titlecase a string. michael@0: * Casing is locale-dependent and context-sensitive. michael@0: * Titlecasing uses a break iterator to find the first characters of words michael@0: * that are to be titlecased. It titlecases those characters and lowercases michael@0: * all others. michael@0: * michael@0: * The titlecase break iterator can be provided to customize for arbitrary michael@0: * styles, using rules and dictionaries beyond the standard iterators. michael@0: * It may be more efficient to always provide an iterator to avoid michael@0: * opening and closing one for each string. michael@0: * The standard titlecase iterator for the root locale implements the michael@0: * algorithm of Unicode TR 21. michael@0: * michael@0: * This function uses only the setText(), first() and next() methods of the michael@0: * provided break iterator. michael@0: * michael@0: * The result may be longer or shorter than the original. michael@0: * The source string and the destination buffer are allowed to overlap. michael@0: * michael@0: * @param dest A buffer for the result string. The result will be zero-terminated if michael@0: * the buffer is large enough. michael@0: * @param destCapacity The size of the buffer (number of UChars). If it is 0, then michael@0: * dest may be NULL and the function will only return the length of the result michael@0: * without writing any of the result string. michael@0: * @param src The original string michael@0: * @param srcLength The length of the original string. If -1, then src must be zero-terminated. michael@0: * @param titleIter A break iterator to find the first characters of words michael@0: * that are to be titlecased. michael@0: * If none is provided (NULL), then a standard titlecase michael@0: * break iterator is opened. michael@0: * @param locale The locale to consider, or "" for the root locale or NULL for the default locale. michael@0: * @param pErrorCode Must be a valid pointer to an error code value, michael@0: * which must not indicate a failure before the function call. michael@0: * @return The length of the result string. It may be greater than destCapacity. In that case, michael@0: * only some of the result was written to the destination buffer. michael@0: * @stable ICU 2.1 michael@0: */ michael@0: U_STABLE int32_t U_EXPORT2 michael@0: u_strToTitle(UChar *dest, int32_t destCapacity, michael@0: const UChar *src, int32_t srcLength, michael@0: UBreakIterator *titleIter, michael@0: const char *locale, michael@0: UErrorCode *pErrorCode); michael@0: michael@0: #endif michael@0: michael@0: /** michael@0: * Case-folds the characters in a string. michael@0: * michael@0: * Case-folding is locale-independent and not context-sensitive, michael@0: * but there is an option for whether to include or exclude mappings for dotted I michael@0: * and dotless i that are marked with 'T' in CaseFolding.txt. michael@0: * michael@0: * The result may be longer or shorter than the original. michael@0: * The source string and the destination buffer are allowed to overlap. michael@0: * michael@0: * @param dest A buffer for the result string. The result will be zero-terminated if michael@0: * the buffer is large enough. michael@0: * @param destCapacity The size of the buffer (number of UChars). If it is 0, then michael@0: * dest may be NULL and the function will only return the length of the result michael@0: * without writing any of the result string. michael@0: * @param src The original string michael@0: * @param srcLength The length of the original string. If -1, then src must be zero-terminated. michael@0: * @param options Either U_FOLD_CASE_DEFAULT or U_FOLD_CASE_EXCLUDE_SPECIAL_I michael@0: * @param pErrorCode Must be a valid pointer to an error code value, michael@0: * which must not indicate a failure before the function call. michael@0: * @return The length of the result string. It may be greater than destCapacity. In that case, michael@0: * only some of the result was written to the destination buffer. michael@0: * @stable ICU 2.0 michael@0: */ michael@0: U_STABLE int32_t U_EXPORT2 michael@0: u_strFoldCase(UChar *dest, int32_t destCapacity, michael@0: const UChar *src, int32_t srcLength, michael@0: uint32_t options, michael@0: UErrorCode *pErrorCode); michael@0: michael@0: #if defined(U_WCHAR_IS_UTF16) || defined(U_WCHAR_IS_UTF32) || !UCONFIG_NO_CONVERSION michael@0: /** michael@0: * Convert a UTF-16 string to a wchar_t string. michael@0: * If it is known at compile time that wchar_t strings are in UTF-16 or UTF-32, then michael@0: * this function simply calls the fast, dedicated function for that. michael@0: * Otherwise, two conversions UTF-16 -> default charset -> wchar_t* are performed. michael@0: * michael@0: * @param dest A buffer for the result string. The result will be zero-terminated if michael@0: * the buffer is large enough. michael@0: * @param destCapacity The size of the buffer (number of wchar_t's). If it is 0, then michael@0: * dest may be NULL and the function will only return the length of the michael@0: * result without writing any of the result string (pre-flighting). michael@0: * @param pDestLength A pointer to receive the number of units written to the destination. If michael@0: * pDestLength!=NULL then *pDestLength is always set to the michael@0: * number of output units corresponding to the transformation of michael@0: * all the input units, even in case of a buffer overflow. michael@0: * @param src The original source string michael@0: * @param srcLength The length of the original string. If -1, then src must be zero-terminated. michael@0: * @param pErrorCode Must be a valid pointer to an error code value, michael@0: * which must not indicate a failure before the function call. michael@0: * @return The pointer to destination buffer. michael@0: * @stable ICU 2.0 michael@0: */ michael@0: U_STABLE wchar_t* U_EXPORT2 michael@0: u_strToWCS(wchar_t *dest, michael@0: int32_t destCapacity, michael@0: int32_t *pDestLength, michael@0: const UChar *src, michael@0: int32_t srcLength, michael@0: UErrorCode *pErrorCode); michael@0: /** michael@0: * Convert a wchar_t string to UTF-16. michael@0: * If it is known at compile time that wchar_t strings are in UTF-16 or UTF-32, then michael@0: * this function simply calls the fast, dedicated function for that. michael@0: * Otherwise, two conversions wchar_t* -> default charset -> UTF-16 are performed. michael@0: * michael@0: * @param dest A buffer for the result string. The result will be zero-terminated if michael@0: * the buffer is large enough. michael@0: * @param destCapacity The size of the buffer (number of UChars). If it is 0, then michael@0: * dest may be NULL and the function will only return the length of the michael@0: * result without writing any of the result string (pre-flighting). michael@0: * @param pDestLength A pointer to receive the number of units written to the destination. If michael@0: * pDestLength!=NULL then *pDestLength is always set to the michael@0: * number of output units corresponding to the transformation of michael@0: * all the input units, even in case of a buffer overflow. michael@0: * @param src The original source string michael@0: * @param srcLength The length of the original string. If -1, then src must be zero-terminated. michael@0: * @param pErrorCode Must be a valid pointer to an error code value, michael@0: * which must not indicate a failure before the function call. michael@0: * @return The pointer to destination buffer. michael@0: * @stable ICU 2.0 michael@0: */ michael@0: U_STABLE UChar* U_EXPORT2 michael@0: u_strFromWCS(UChar *dest, michael@0: int32_t destCapacity, michael@0: int32_t *pDestLength, michael@0: const wchar_t *src, michael@0: int32_t srcLength, michael@0: UErrorCode *pErrorCode); michael@0: #endif /* defined(U_WCHAR_IS_UTF16) || defined(U_WCHAR_IS_UTF32) || !UCONFIG_NO_CONVERSION */ michael@0: michael@0: /** michael@0: * Convert a UTF-16 string to UTF-8. michael@0: * If the input string is not well-formed, then the U_INVALID_CHAR_FOUND error code is set. michael@0: * michael@0: * @param dest A buffer for the result string. The result will be zero-terminated if michael@0: * the buffer is large enough. michael@0: * @param destCapacity The size of the buffer (number of chars). If it is 0, then michael@0: * dest may be NULL and the function will only return the length of the michael@0: * result without writing any of the result string (pre-flighting). michael@0: * @param pDestLength A pointer to receive the number of units written to the destination. If michael@0: * pDestLength!=NULL then *pDestLength is always set to the michael@0: * number of output units corresponding to the transformation of michael@0: * all the input units, even in case of a buffer overflow. michael@0: * @param src The original source string michael@0: * @param srcLength The length of the original string. If -1, then src must be zero-terminated. michael@0: * @param pErrorCode Must be a valid pointer to an error code value, michael@0: * which must not indicate a failure before the function call. michael@0: * @return The pointer to destination buffer. michael@0: * @stable ICU 2.0 michael@0: * @see u_strToUTF8WithSub michael@0: * @see u_strFromUTF8 michael@0: */ michael@0: U_STABLE char* U_EXPORT2 michael@0: u_strToUTF8(char *dest, michael@0: int32_t destCapacity, michael@0: int32_t *pDestLength, michael@0: const UChar *src, michael@0: int32_t srcLength, michael@0: UErrorCode *pErrorCode); michael@0: michael@0: /** michael@0: * Convert a UTF-8 string to UTF-16. michael@0: * If the input string is not well-formed, then the U_INVALID_CHAR_FOUND error code is set. michael@0: * michael@0: * @param dest A buffer for the result string. The result will be zero-terminated if michael@0: * the buffer is large enough. michael@0: * @param destCapacity The size of the buffer (number of UChars). If it is 0, then michael@0: * dest may be NULL and the function will only return the length of the michael@0: * result without writing any of the result string (pre-flighting). michael@0: * @param pDestLength A pointer to receive the number of units written to the destination. If michael@0: * pDestLength!=NULL then *pDestLength is always set to the michael@0: * number of output units corresponding to the transformation of michael@0: * all the input units, even in case of a buffer overflow. michael@0: * @param src The original source string michael@0: * @param srcLength The length of the original string. If -1, then src must be zero-terminated. michael@0: * @param pErrorCode Must be a valid pointer to an error code value, michael@0: * which must not indicate a failure before the function call. michael@0: * @return The pointer to destination buffer. michael@0: * @stable ICU 2.0 michael@0: * @see u_strFromUTF8WithSub michael@0: * @see u_strFromUTF8Lenient michael@0: */ michael@0: U_STABLE UChar* U_EXPORT2 michael@0: u_strFromUTF8(UChar *dest, michael@0: int32_t destCapacity, michael@0: int32_t *pDestLength, michael@0: const char *src, michael@0: int32_t srcLength, michael@0: UErrorCode *pErrorCode); michael@0: michael@0: /** michael@0: * Convert a UTF-16 string to UTF-8. michael@0: * If the input string is not well-formed, then the U_INVALID_CHAR_FOUND error code is set. michael@0: * michael@0: * Same as u_strToUTF8() except for the additional subchar which is output for michael@0: * illegal input sequences, instead of stopping with the U_INVALID_CHAR_FOUND error code. michael@0: * With subchar==U_SENTINEL, this function behaves exactly like u_strToUTF8(). michael@0: * michael@0: * @param dest A buffer for the result string. The result will be zero-terminated if michael@0: * the buffer is large enough. michael@0: * @param destCapacity The size of the buffer (number of chars). If it is 0, then michael@0: * dest may be NULL and the function will only return the length of the michael@0: * result without writing any of the result string (pre-flighting). michael@0: * @param pDestLength A pointer to receive the number of units written to the destination. If michael@0: * pDestLength!=NULL then *pDestLength is always set to the michael@0: * number of output units corresponding to the transformation of michael@0: * all the input units, even in case of a buffer overflow. michael@0: * @param src The original source string michael@0: * @param srcLength The length of the original string. If -1, then src must be zero-terminated. michael@0: * @param subchar The substitution character to use in place of an illegal input sequence, michael@0: * or U_SENTINEL if the function is to return with U_INVALID_CHAR_FOUND instead. michael@0: * A substitution character can be any valid Unicode code point (up to U+10FFFF) michael@0: * except for surrogate code points (U+D800..U+DFFF). michael@0: * The recommended value is U+FFFD "REPLACEMENT CHARACTER". michael@0: * @param pNumSubstitutions Output parameter receiving the number of substitutions if subchar>=0. michael@0: * Set to 0 if no substitutions occur or subchar<0. michael@0: * pNumSubstitutions can be NULL. michael@0: * @param pErrorCode Pointer to a standard ICU error code. Its input value must michael@0: * pass the U_SUCCESS() test, or else the function returns michael@0: * immediately. Check for U_FAILURE() on output or use with michael@0: * function chaining. (See User Guide for details.) michael@0: * @return The pointer to destination buffer. michael@0: * @see u_strToUTF8 michael@0: * @see u_strFromUTF8WithSub michael@0: * @stable ICU 3.6 michael@0: */ michael@0: U_STABLE char* U_EXPORT2 michael@0: u_strToUTF8WithSub(char *dest, michael@0: int32_t destCapacity, michael@0: int32_t *pDestLength, michael@0: const UChar *src, michael@0: int32_t srcLength, michael@0: UChar32 subchar, int32_t *pNumSubstitutions, michael@0: UErrorCode *pErrorCode); michael@0: michael@0: /** michael@0: * Convert a UTF-8 string to UTF-16. michael@0: * If the input string is not well-formed, then the U_INVALID_CHAR_FOUND error code is set. michael@0: * michael@0: * Same as u_strFromUTF8() except for the additional subchar which is output for michael@0: * illegal input sequences, instead of stopping with the U_INVALID_CHAR_FOUND error code. michael@0: * With subchar==U_SENTINEL, this function behaves exactly like u_strFromUTF8(). michael@0: * michael@0: * @param dest A buffer for the result string. The result will be zero-terminated if michael@0: * the buffer is large enough. michael@0: * @param destCapacity The size of the buffer (number of UChars). If it is 0, then michael@0: * dest may be NULL and the function will only return the length of the michael@0: * result without writing any of the result string (pre-flighting). michael@0: * @param pDestLength A pointer to receive the number of units written to the destination. If michael@0: * pDestLength!=NULL then *pDestLength is always set to the michael@0: * number of output units corresponding to the transformation of michael@0: * all the input units, even in case of a buffer overflow. michael@0: * @param src The original source string michael@0: * @param srcLength The length of the original string. If -1, then src must be zero-terminated. michael@0: * @param subchar The substitution character to use in place of an illegal input sequence, michael@0: * or U_SENTINEL if the function is to return with U_INVALID_CHAR_FOUND instead. michael@0: * A substitution character can be any valid Unicode code point (up to U+10FFFF) michael@0: * except for surrogate code points (U+D800..U+DFFF). michael@0: * The recommended value is U+FFFD "REPLACEMENT CHARACTER". michael@0: * @param pNumSubstitutions Output parameter receiving the number of substitutions if subchar>=0. michael@0: * Set to 0 if no substitutions occur or subchar<0. michael@0: * pNumSubstitutions can be NULL. michael@0: * @param pErrorCode Pointer to a standard ICU error code. Its input value must michael@0: * pass the U_SUCCESS() test, or else the function returns michael@0: * immediately. Check for U_FAILURE() on output or use with michael@0: * function chaining. (See User Guide for details.) michael@0: * @return The pointer to destination buffer. michael@0: * @see u_strFromUTF8 michael@0: * @see u_strFromUTF8Lenient michael@0: * @see u_strToUTF8WithSub michael@0: * @stable ICU 3.6 michael@0: */ michael@0: U_STABLE UChar* U_EXPORT2 michael@0: u_strFromUTF8WithSub(UChar *dest, michael@0: int32_t destCapacity, michael@0: int32_t *pDestLength, michael@0: const char *src, michael@0: int32_t srcLength, michael@0: UChar32 subchar, int32_t *pNumSubstitutions, michael@0: UErrorCode *pErrorCode); michael@0: michael@0: /** michael@0: * Convert a UTF-8 string to UTF-16. michael@0: * michael@0: * Same as u_strFromUTF8() except that this function is designed to be very fast, michael@0: * which it achieves by being lenient about malformed UTF-8 sequences. michael@0: * This function is intended for use in environments where UTF-8 text is michael@0: * expected to be well-formed. michael@0: * michael@0: * Its semantics are: michael@0: * - Well-formed UTF-8 text is correctly converted to well-formed UTF-16 text. michael@0: * - The function will not read beyond the input string, nor write beyond michael@0: * the destCapacity. michael@0: * - Malformed UTF-8 results in "garbage" 16-bit Unicode strings which may not michael@0: * be well-formed UTF-16. michael@0: * The function will resynchronize to valid code point boundaries michael@0: * within a small number of code points after an illegal sequence. michael@0: * - Non-shortest forms are not detected and will result in "spoofing" output. michael@0: * michael@0: * For further performance improvement, if srcLength is given (>=0), michael@0: * then it must be destCapacity>=srcLength. michael@0: * michael@0: * There is no inverse u_strToUTF8Lenient() function because there is practically michael@0: * no performance gain from not checking that a UTF-16 string is well-formed. michael@0: * michael@0: * @param dest A buffer for the result string. The result will be zero-terminated if michael@0: * the buffer is large enough. michael@0: * @param destCapacity The size of the buffer (number of UChars). If it is 0, then michael@0: * dest may be NULL and the function will only return the length of the michael@0: * result without writing any of the result string (pre-flighting). michael@0: * Unlike for other ICU functions, if srcLength>=0 then it michael@0: * must be destCapacity>=srcLength. michael@0: * @param pDestLength A pointer to receive the number of units written to the destination. If michael@0: * pDestLength!=NULL then *pDestLength is always set to the michael@0: * number of output units corresponding to the transformation of michael@0: * all the input units, even in case of a buffer overflow. michael@0: * Unlike for other ICU functions, if srcLength>=0 but michael@0: * destCapacity=0. michael@0: * Set to 0 if no substitutions occur or subchar<0. michael@0: * pNumSubstitutions can be NULL. michael@0: * @param pErrorCode Pointer to a standard ICU error code. Its input value must michael@0: * pass the U_SUCCESS() test, or else the function returns michael@0: * immediately. Check for U_FAILURE() on output or use with michael@0: * function chaining. (See User Guide for details.) michael@0: * @return The pointer to destination buffer. michael@0: * @see u_strToUTF32 michael@0: * @see u_strFromUTF32WithSub michael@0: * @stable ICU 4.2 michael@0: */ michael@0: U_STABLE UChar32* U_EXPORT2 michael@0: u_strToUTF32WithSub(UChar32 *dest, michael@0: int32_t destCapacity, michael@0: int32_t *pDestLength, michael@0: const UChar *src, michael@0: int32_t srcLength, michael@0: UChar32 subchar, int32_t *pNumSubstitutions, michael@0: UErrorCode *pErrorCode); michael@0: michael@0: /** michael@0: * Convert a UTF-32 string to UTF-16. michael@0: * If the input string is not well-formed, then the U_INVALID_CHAR_FOUND error code is set. michael@0: * michael@0: * Same as u_strFromUTF32() except for the additional subchar which is output for michael@0: * illegal input sequences, instead of stopping with the U_INVALID_CHAR_FOUND error code. michael@0: * With subchar==U_SENTINEL, this function behaves exactly like u_strFromUTF32(). michael@0: * michael@0: * @param dest A buffer for the result string. The result will be zero-terminated if michael@0: * the buffer is large enough. michael@0: * @param destCapacity The size of the buffer (number of UChars). If it is 0, then michael@0: * dest may be NULL and the function will only return the length of the michael@0: * result without writing any of the result string (pre-flighting). michael@0: * @param pDestLength A pointer to receive the number of units written to the destination. If michael@0: * pDestLength!=NULL then *pDestLength is always set to the michael@0: * number of output units corresponding to the transformation of michael@0: * all the input units, even in case of a buffer overflow. michael@0: * @param src The original source string michael@0: * @param srcLength The length of the original string. If -1, then src must be zero-terminated. michael@0: * @param subchar The substitution character to use in place of an illegal input sequence, michael@0: * or U_SENTINEL if the function is to return with U_INVALID_CHAR_FOUND instead. michael@0: * A substitution character can be any valid Unicode code point (up to U+10FFFF) michael@0: * except for surrogate code points (U+D800..U+DFFF). michael@0: * The recommended value is U+FFFD "REPLACEMENT CHARACTER". michael@0: * @param pNumSubstitutions Output parameter receiving the number of substitutions if subchar>=0. michael@0: * Set to 0 if no substitutions occur or subchar<0. michael@0: * pNumSubstitutions can be NULL. michael@0: * @param pErrorCode Pointer to a standard ICU error code. Its input value must michael@0: * pass the U_SUCCESS() test, or else the function returns michael@0: * immediately. Check for U_FAILURE() on output or use with michael@0: * function chaining. (See User Guide for details.) michael@0: * @return The pointer to destination buffer. michael@0: * @see u_strFromUTF32 michael@0: * @see u_strToUTF32WithSub michael@0: * @stable ICU 4.2 michael@0: */ michael@0: U_STABLE UChar* U_EXPORT2 michael@0: u_strFromUTF32WithSub(UChar *dest, michael@0: int32_t destCapacity, michael@0: int32_t *pDestLength, michael@0: const UChar32 *src, michael@0: int32_t srcLength, michael@0: UChar32 subchar, int32_t *pNumSubstitutions, michael@0: UErrorCode *pErrorCode); michael@0: michael@0: /** michael@0: * Convert a 16-bit Unicode string to Java Modified UTF-8. michael@0: * See http://java.sun.com/javase/6/docs/api/java/io/DataInput.html#modified-utf-8 michael@0: * michael@0: * This function behaves according to the documentation for Java DataOutput.writeUTF() michael@0: * except that it does not encode the output length in the destination buffer michael@0: * and does not have an output length restriction. michael@0: * See http://java.sun.com/javase/6/docs/api/java/io/DataOutput.html#writeUTF(java.lang.String) michael@0: * michael@0: * The input string need not be well-formed UTF-16. michael@0: * (Therefore there is no subchar parameter.) michael@0: * michael@0: * @param dest A buffer for the result string. The result will be zero-terminated if michael@0: * the buffer is large enough. michael@0: * @param destCapacity The size of the buffer (number of chars). If it is 0, then michael@0: * dest may be NULL and the function will only return the length of the michael@0: * result without writing any of the result string (pre-flighting). michael@0: * @param pDestLength A pointer to receive the number of units written to the destination. If michael@0: * pDestLength!=NULL then *pDestLength is always set to the michael@0: * number of output units corresponding to the transformation of michael@0: * all the input units, even in case of a buffer overflow. michael@0: * @param src The original source string michael@0: * @param srcLength The length of the original string. If -1, then src must be zero-terminated. michael@0: * @param pErrorCode Pointer to a standard ICU error code. Its input value must michael@0: * pass the U_SUCCESS() test, or else the function returns michael@0: * immediately. Check for U_FAILURE() on output or use with michael@0: * function chaining. (See User Guide for details.) michael@0: * @return The pointer to destination buffer. michael@0: * @stable ICU 4.4 michael@0: * @see u_strToUTF8WithSub michael@0: * @see u_strFromJavaModifiedUTF8WithSub michael@0: */ michael@0: U_STABLE char* U_EXPORT2 michael@0: u_strToJavaModifiedUTF8( michael@0: char *dest, michael@0: int32_t destCapacity, michael@0: int32_t *pDestLength, michael@0: const UChar *src, michael@0: int32_t srcLength, michael@0: UErrorCode *pErrorCode); michael@0: michael@0: /** michael@0: * Convert a Java Modified UTF-8 string to a 16-bit Unicode string. michael@0: * If the input string is not well-formed, then the U_INVALID_CHAR_FOUND error code is set. michael@0: * michael@0: * This function behaves according to the documentation for Java DataInput.readUTF() michael@0: * except that it takes a length parameter rather than michael@0: * interpreting the first two input bytes as the length. michael@0: * See http://java.sun.com/javase/6/docs/api/java/io/DataInput.html#readUTF() michael@0: * michael@0: * The output string may not be well-formed UTF-16. michael@0: * michael@0: * @param dest A buffer for the result string. The result will be zero-terminated if michael@0: * the buffer is large enough. michael@0: * @param destCapacity The size of the buffer (number of UChars). If it is 0, then michael@0: * dest may be NULL and the function will only return the length of the michael@0: * result without writing any of the result string (pre-flighting). michael@0: * @param pDestLength A pointer to receive the number of units written to the destination. If michael@0: * pDestLength!=NULL then *pDestLength is always set to the michael@0: * number of output units corresponding to the transformation of michael@0: * all the input units, even in case of a buffer overflow. michael@0: * @param src The original source string michael@0: * @param srcLength The length of the original string. If -1, then src must be zero-terminated. michael@0: * @param subchar The substitution character to use in place of an illegal input sequence, michael@0: * or U_SENTINEL if the function is to return with U_INVALID_CHAR_FOUND instead. michael@0: * A substitution character can be any valid Unicode code point (up to U+10FFFF) michael@0: * except for surrogate code points (U+D800..U+DFFF). michael@0: * The recommended value is U+FFFD "REPLACEMENT CHARACTER". michael@0: * @param pNumSubstitutions Output parameter receiving the number of substitutions if subchar>=0. michael@0: * Set to 0 if no substitutions occur or subchar<0. michael@0: * pNumSubstitutions can be NULL. michael@0: * @param pErrorCode Pointer to a standard ICU error code. Its input value must michael@0: * pass the U_SUCCESS() test, or else the function returns michael@0: * immediately. Check for U_FAILURE() on output or use with michael@0: * function chaining. (See User Guide for details.) michael@0: * @return The pointer to destination buffer. michael@0: * @see u_strFromUTF8WithSub michael@0: * @see u_strFromUTF8Lenient michael@0: * @see u_strToJavaModifiedUTF8 michael@0: * @stable ICU 4.4 michael@0: */ michael@0: U_STABLE UChar* U_EXPORT2 michael@0: u_strFromJavaModifiedUTF8WithSub( michael@0: UChar *dest, michael@0: int32_t destCapacity, michael@0: int32_t *pDestLength, michael@0: const char *src, michael@0: int32_t srcLength, michael@0: UChar32 subchar, int32_t *pNumSubstitutions, michael@0: UErrorCode *pErrorCode); michael@0: michael@0: #endif