1b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru/* 2b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru********************************************************************** 350294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho* Copyright (C) 1998-2010, International Business Machines 4b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru* Corporation and others. All Rights Reserved. 5b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru********************************************************************** 6b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru* 7b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru* File ustring.h 8b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru* 9b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru* Modification History: 10b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru* 11b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru* Date Name Description 12b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru* 12/07/98 bertrand Creation. 13b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru****************************************************************************** 14b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru*/ 15b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru 16b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru#ifndef USTRING_H 17b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru#define USTRING_H 18b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru 19b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru#include "unicode/utypes.h" 20b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru#include "unicode/putil.h" 21b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru#include "unicode/uiter.h" 22b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru 23b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru/** Simple declaration for u_strToTitle() to avoid including unicode/ubrk.h. @stable ICU 2.1*/ 24b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru#ifndef UBRK_TYPEDEF_UBREAK_ITERATOR 25b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru# define UBRK_TYPEDEF_UBREAK_ITERATOR 2650294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho typedef struct UBreakIterator UBreakIterator; 27b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru#endif 28b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru 29b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru/** 30b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * \file 31b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * \brief C API: Unicode string handling functions 32b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * 33b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * These C API functions provide general Unicode string handling. 34b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * 35b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * Some functions are equivalent in name, signature, and behavior to the ANSI C <string.h> 36b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * functions. (For example, they do not check for bad arguments like NULL string pointers.) 37b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * In some cases, only the thread-safe variant of such a function is implemented here 38b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * (see u_strtok_r()). 39b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * 40b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * Other functions provide more Unicode-specific functionality like locale-specific 41b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * upper/lower-casing and string comparison in code point order. 42b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * 43b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * ICU uses 16-bit Unicode (UTF-16) in the form of arrays of UChar code units. 44b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * UTF-16 encodes each Unicode code point with either one or two UChar code units. 45b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * (This is the default form of Unicode, and a forward-compatible extension of the original, 46b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * fixed-width form that was known as UCS-2. UTF-16 superseded UCS-2 with Unicode 2.0 47b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * in 1996.) 48b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * 49b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * Some APIs accept a 32-bit UChar32 value for a single code point. 50b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * 51b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * ICU also handles 16-bit Unicode text with unpaired surrogates. 52b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * Such text is not well-formed UTF-16. 53b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * Code-point-related functions treat unpaired surrogates as surrogate code points, 54b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * i.e., as separate units. 55b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * 56b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * Although UTF-16 is a variable-width encoding form (like some legacy multi-byte encodings), 57b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * it is much more efficient even for random access because the code unit values 58b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * for single-unit characters vs. lead units vs. trail units are completely disjoint. 59b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * This means that it is easy to determine character (code point) boundaries from 60b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * random offsets in the string. 61b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * 62b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * Unicode (UTF-16) string processing is optimized for the single-unit case. 63b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * Although it is important to support supplementary characters 64b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * (which use pairs of lead/trail code units called "surrogates"), 65b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * their occurrence is rare. Almost all characters in modern use require only 66b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * a single UChar code unit (i.e., their code point values are <=0xffff). 67b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * 68b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * For more details see the User Guide Strings chapter (http://icu-project.org/userguide/strings.html). 69b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * For a discussion of the handling of unpaired surrogates see also 70b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * Jitterbug 2145 and its icu mailing list proposal on 2002-sep-18. 71b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru */ 72b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru 73b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru/** 74c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru * \defgroup ustring_ustrlen String Length 75c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru * \ingroup ustring_strlen 76b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru */ 77b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru/*@{*/ 78b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru/** 79b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * Determine the length of an array of UChar. 80b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * 81b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param s The array of UChars, NULL (U+0000) terminated. 82b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @return The number of UChars in <code>chars</code>, minus the terminator. 83b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @stable ICU 2.0 84b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru */ 85b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste QueruU_STABLE int32_t U_EXPORT2 86b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queruu_strlen(const UChar *s); 87b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru/*@}*/ 88b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru 89b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru/** 90b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * Count Unicode code points in the length UChar code units of the string. 91b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * A code point may occupy either one or two UChar code units. 92b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * Counting code points involves reading all code units. 93b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * 94b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * This functions is basically the inverse of the U16_FWD_N() macro (see utf.h). 95b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * 96b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param s The input string. 97b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param length The number of UChar code units to be checked, or -1 to count all 98b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * code points before the first NUL (U+0000). 99b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @return The number of code points in the specified code units. 100b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @stable ICU 2.0 101b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru */ 102b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste QueruU_STABLE int32_t U_EXPORT2 103b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queruu_countChar32(const UChar *s, int32_t length); 104b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru 105b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru/** 106b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * Check if the string contains more Unicode code points than a certain number. 107b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * This is more efficient than counting all code points in the entire string 108b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * and comparing that number with a threshold. 109b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * This function may not need to scan the string at all if the length is known 110b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * (not -1 for NUL-termination) and falls within a certain range, and 111b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * never needs to count more than 'number+1' code points. 112b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * Logically equivalent to (u_countChar32(s, length)>number). 113b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * A Unicode code point may occupy either one or two UChar code units. 114b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * 115b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param s The input string. 116b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param length The length of the string, or -1 if it is NUL-terminated. 117b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param number The number of code points in the string is compared against 118b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * the 'number' parameter. 119b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @return Boolean value for whether the string contains more Unicode code points 120b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * than 'number'. Same as (u_countChar32(s, length)>number). 121b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @stable ICU 2.4 122b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru */ 123b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste QueruU_STABLE UBool U_EXPORT2 124b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queruu_strHasMoreChar32Than(const UChar *s, int32_t length, int32_t number); 125b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru 126b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru/** 127b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * Concatenate two ustrings. Appends a copy of <code>src</code>, 128b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * including the null terminator, to <code>dst</code>. The initial copied 129b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * character from <code>src</code> overwrites the null terminator in <code>dst</code>. 130b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * 131b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param dst The destination string. 132b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param src The source string. 133b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @return A pointer to <code>dst</code>. 134b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @stable ICU 2.0 135b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru */ 136b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste QueruU_STABLE UChar* U_EXPORT2 137b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queruu_strcat(UChar *dst, 138b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru const UChar *src); 139b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru 140b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru/** 141b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * Concatenate two ustrings. 142b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * Appends at most <code>n</code> characters from <code>src</code> to <code>dst</code>. 143b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * Adds a terminating NUL. 144b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * If src is too long, then only <code>n-1</code> characters will be copied 145b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * before the terminating NUL. 146b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * If <code>n<=0</code> then dst is not modified. 147b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * 148b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param dst The destination string. 149b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param src The source string. 15050294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho * @param n The maximum number of characters to append. 151b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @return A pointer to <code>dst</code>. 152b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @stable ICU 2.0 153b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru */ 154b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste QueruU_STABLE UChar* U_EXPORT2 155b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queruu_strncat(UChar *dst, 156b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru const UChar *src, 157b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru int32_t n); 158b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru 159b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru/** 160b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * Find the first occurrence of a substring in a string. 161b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * The substring is found at code point boundaries. 162b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * That means that if the substring begins with 163b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * a trail surrogate or ends with a lead surrogate, 164b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * then it is found only if these surrogates stand alone in the text. 165b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * Otherwise, the substring edge units would be matched against 166b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * halves of surrogate pairs. 167b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * 168b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param s The string to search (NUL-terminated). 169b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param substring The substring to find (NUL-terminated). 170b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @return A pointer to the first occurrence of <code>substring</code> in <code>s</code>, 171b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * or <code>s</code> itself if the <code>substring</code> is empty, 172b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * or <code>NULL</code> if <code>substring</code> is not in <code>s</code>. 173b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @stable ICU 2.0 174b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * 175b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @see u_strrstr 176b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @see u_strFindFirst 177b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @see u_strFindLast 178b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru */ 179b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste QueruU_STABLE UChar * U_EXPORT2 180b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queruu_strstr(const UChar *s, const UChar *substring); 181b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru 182b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru/** 183b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * Find the first occurrence of a substring in a string. 184b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * The substring is found at code point boundaries. 185b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * That means that if the substring begins with 186b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * a trail surrogate or ends with a lead surrogate, 187b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * then it is found only if these surrogates stand alone in the text. 188b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * Otherwise, the substring edge units would be matched against 189b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * halves of surrogate pairs. 190b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * 191b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param s The string to search. 192b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param length The length of s (number of UChars), or -1 if it is NUL-terminated. 193b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param substring The substring to find (NUL-terminated). 194b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param subLength The length of substring (number of UChars), or -1 if it is NUL-terminated. 195b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @return A pointer to the first occurrence of <code>substring</code> in <code>s</code>, 196b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * or <code>s</code> itself if the <code>substring</code> is empty, 197b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * or <code>NULL</code> if <code>substring</code> is not in <code>s</code>. 198b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @stable ICU 2.4 199b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * 200b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @see u_strstr 201b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @see u_strFindLast 202b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru */ 203b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste QueruU_STABLE UChar * U_EXPORT2 204b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queruu_strFindFirst(const UChar *s, int32_t length, const UChar *substring, int32_t subLength); 205b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru 206b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru/** 207b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * Find the first occurrence of a BMP code point in a string. 208b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * A surrogate code point is found only if its match in the text is not 209b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * part of a surrogate pair. 210b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * A NUL character is found at the string terminator. 211b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * 212b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param s The string to search (NUL-terminated). 213b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param c The BMP code point to find. 214b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @return A pointer to the first occurrence of <code>c</code> in <code>s</code> 215b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * or <code>NULL</code> if <code>c</code> is not in <code>s</code>. 216b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @stable ICU 2.0 217b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * 218b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @see u_strchr32 219b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @see u_memchr 220b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @see u_strstr 221b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @see u_strFindFirst 222b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru */ 223b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste QueruU_STABLE UChar * U_EXPORT2 224b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queruu_strchr(const UChar *s, UChar c); 225b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru 226b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru/** 227b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * Find the first occurrence of a code point in a string. 228b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * A surrogate code point is found only if its match in the text is not 229b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * part of a surrogate pair. 230b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * A NUL character is found at the string terminator. 231b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * 232b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param s The string to search (NUL-terminated). 233b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param c The code point to find. 234b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @return A pointer to the first occurrence of <code>c</code> in <code>s</code> 235b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * or <code>NULL</code> if <code>c</code> is not in <code>s</code>. 236b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @stable ICU 2.0 237b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * 238b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @see u_strchr 239b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @see u_memchr32 240b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @see u_strstr 241b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @see u_strFindFirst 242b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru */ 243b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste QueruU_STABLE UChar * U_EXPORT2 244b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queruu_strchr32(const UChar *s, UChar32 c); 245b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru 246b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru/** 247b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * Find the last occurrence of a substring in a string. 248b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * The substring is found at code point boundaries. 249b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * That means that if the substring begins with 250b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * a trail surrogate or ends with a lead surrogate, 251b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * then it is found only if these surrogates stand alone in the text. 252b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * Otherwise, the substring edge units would be matched against 253b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * halves of surrogate pairs. 254b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * 255b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param s The string to search (NUL-terminated). 256b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param substring The substring to find (NUL-terminated). 257b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @return A pointer to the last occurrence of <code>substring</code> in <code>s</code>, 258b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * or <code>s</code> itself if the <code>substring</code> is empty, 259b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * or <code>NULL</code> if <code>substring</code> is not in <code>s</code>. 260b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @stable ICU 2.4 261b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * 262b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @see u_strstr 263b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @see u_strFindFirst 264b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @see u_strFindLast 265b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru */ 266b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste QueruU_STABLE UChar * U_EXPORT2 267b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queruu_strrstr(const UChar *s, const UChar *substring); 268b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru 269b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru/** 270b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * Find the last occurrence of a substring in a string. 271b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * The substring is found at code point boundaries. 272b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * That means that if the substring begins with 273b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * a trail surrogate or ends with a lead surrogate, 274b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * then it is found only if these surrogates stand alone in the text. 275b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * Otherwise, the substring edge units would be matched against 276b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * halves of surrogate pairs. 277b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * 278b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param s The string to search. 279b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param length The length of s (number of UChars), or -1 if it is NUL-terminated. 280b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param substring The substring to find (NUL-terminated). 281b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param subLength The length of substring (number of UChars), or -1 if it is NUL-terminated. 282b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @return A pointer to the last occurrence of <code>substring</code> in <code>s</code>, 283b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * or <code>s</code> itself if the <code>substring</code> is empty, 284b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * or <code>NULL</code> if <code>substring</code> is not in <code>s</code>. 285b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @stable ICU 2.4 286b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * 287b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @see u_strstr 288b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @see u_strFindLast 289b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru */ 290b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste QueruU_STABLE UChar * U_EXPORT2 291b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queruu_strFindLast(const UChar *s, int32_t length, const UChar *substring, int32_t subLength); 292b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru 293b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru/** 294b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * Find the last occurrence of a BMP code point in a string. 295b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * A surrogate code point is found only if its match in the text is not 296b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * part of a surrogate pair. 297b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * A NUL character is found at the string terminator. 298b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * 299b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param s The string to search (NUL-terminated). 300b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param c The BMP code point to find. 301b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @return A pointer to the last occurrence of <code>c</code> in <code>s</code> 302b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * or <code>NULL</code> if <code>c</code> is not in <code>s</code>. 303b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @stable ICU 2.4 304b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * 305b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @see u_strrchr32 306b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @see u_memrchr 307b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @see u_strrstr 308b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @see u_strFindLast 309b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru */ 310b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste QueruU_STABLE UChar * U_EXPORT2 311b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queruu_strrchr(const UChar *s, UChar c); 312b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru 313b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru/** 314b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * Find the last occurrence of a code point in a string. 315b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * A surrogate code point is found only if its match in the text is not 316b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * part of a surrogate pair. 317b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * A NUL character is found at the string terminator. 318b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * 319b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param s The string to search (NUL-terminated). 320b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param c The code point to find. 321b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @return A pointer to the last occurrence of <code>c</code> in <code>s</code> 322b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * or <code>NULL</code> if <code>c</code> is not in <code>s</code>. 323b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @stable ICU 2.4 324b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * 325b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @see u_strrchr 326b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @see u_memchr32 327b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @see u_strrstr 328b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @see u_strFindLast 329b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru */ 330b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste QueruU_STABLE UChar * U_EXPORT2 331b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queruu_strrchr32(const UChar *s, UChar32 c); 332b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru 333b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru/** 334b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * Locates the first occurrence in the string <code>string</code> of any of the characters 335b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * in the string <code>matchSet</code>. 336b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * Works just like C's strpbrk but with Unicode. 337b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * 338b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param string The string in which to search, NUL-terminated. 339b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param matchSet A NUL-terminated string defining a set of code points 340b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * for which to search in the text string. 341b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @return A pointer to the character in <code>string</code> that matches one of the 342b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * characters in <code>matchSet</code>, or NULL if no such character is found. 343b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @stable ICU 2.0 344b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru */ 345b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste QueruU_STABLE UChar * U_EXPORT2 346b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queruu_strpbrk(const UChar *string, const UChar *matchSet); 347b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru 348b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru/** 349b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * Returns the number of consecutive characters in <code>string</code>, 350b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * beginning with the first, that do not occur somewhere in <code>matchSet</code>. 351b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * Works just like C's strcspn but with Unicode. 352b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * 353b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param string The string in which to search, NUL-terminated. 354b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param matchSet A NUL-terminated string defining a set of code points 355b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * for which to search in the text string. 356b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @return The number of initial characters in <code>string</code> that do not 357b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * occur in <code>matchSet</code>. 358b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @see u_strspn 359b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @stable ICU 2.0 360b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru */ 361b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste QueruU_STABLE int32_t U_EXPORT2 362b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queruu_strcspn(const UChar *string, const UChar *matchSet); 363b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru 364b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru/** 365b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * Returns the number of consecutive characters in <code>string</code>, 366b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * beginning with the first, that occur somewhere in <code>matchSet</code>. 367b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * Works just like C's strspn but with Unicode. 368b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * 369b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param string The string in which to search, NUL-terminated. 370b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param matchSet A NUL-terminated string defining a set of code points 371b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * for which to search in the text string. 372b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @return The number of initial characters in <code>string</code> that do 373b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * occur in <code>matchSet</code>. 374b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @see u_strcspn 375b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @stable ICU 2.0 376b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru */ 377b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste QueruU_STABLE int32_t U_EXPORT2 378b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queruu_strspn(const UChar *string, const UChar *matchSet); 379b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru 380b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru/** 381b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * The string tokenizer API allows an application to break a string into 382b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * tokens. Unlike strtok(), the saveState (the current pointer within the 383b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * original string) is maintained in saveState. In the first call, the 384b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * argument src is a pointer to the string. In subsequent calls to 385b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * return successive tokens of that string, src must be specified as 386b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * NULL. The value saveState is set by this function to maintain the 387b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * function's position within the string, and on each subsequent call 388b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * you must give this argument the same variable. This function does 389b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * handle surrogate pairs. This function is similar to the strtok_r() 390b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * the POSIX Threads Extension (1003.1c-1995) version. 391b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * 392b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param src String containing token(s). This string will be modified. 393b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * After the first call to u_strtok_r(), this argument must 394b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * be NULL to get to the next token. 395b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param delim Set of delimiter characters (Unicode code points). 396b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param saveState The current pointer within the original string, 397b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * which is set by this function. The saveState 398b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * parameter should the address of a local variable of type 399b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * UChar *. (i.e. defined "Uhar *myLocalSaveState" and use 400b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * &myLocalSaveState for this parameter). 401b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @return A pointer to the next token found in src, or NULL 402b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * when there are no more tokens. 403b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @stable ICU 2.0 404b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru */ 405b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste QueruU_STABLE UChar * U_EXPORT2 406b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queruu_strtok_r(UChar *src, 407b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru const UChar *delim, 408b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru UChar **saveState); 409b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru 410b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru/** 411b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * Compare two Unicode strings for bitwise equality (code unit order). 412b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * 413b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param s1 A string to compare. 414b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param s2 A string to compare. 415b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @return 0 if <code>s1</code> and <code>s2</code> are bitwise equal; a negative 416b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * value if <code>s1</code> is bitwise less than <code>s2,</code>; a positive 417b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * value if <code>s1</code> is bitwise greater than <code>s2</code>. 418b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @stable ICU 2.0 419b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru */ 420b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste QueruU_STABLE int32_t U_EXPORT2 421b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queruu_strcmp(const UChar *s1, 422b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru const UChar *s2); 423b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru 424b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru/** 425b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * Compare two Unicode strings in code point order. 426b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * See u_strCompare for details. 427b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * 428b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param s1 A string to compare. 429b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param s2 A string to compare. 430b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @return a negative/zero/positive integer corresponding to whether 431b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * the first string is less than/equal to/greater than the second one 432b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * in code point order 433b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @stable ICU 2.0 434b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru */ 435b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste QueruU_STABLE int32_t U_EXPORT2 436b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queruu_strcmpCodePointOrder(const UChar *s1, const UChar *s2); 437b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru 438b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru/** 439b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * Compare two Unicode strings (binary order). 440b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * 441b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * The comparison can be done in code unit order or in code point order. 442b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * They differ only in UTF-16 when 443b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * comparing supplementary code points (U+10000..U+10ffff) 444b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * to BMP code points near the end of the BMP (i.e., U+e000..U+ffff). 445b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * In code unit order, high BMP code points sort after supplementary code points 446b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * because they are stored as pairs of surrogates which are at U+d800..U+dfff. 447b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * 448b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * This functions works with strings of different explicitly specified lengths 449b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * unlike the ANSI C-like u_strcmp() and u_memcmp() etc. 450b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * NUL-terminated strings are possible with length arguments of -1. 451b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * 452b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param s1 First source string. 453b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param length1 Length of first source string, or -1 if NUL-terminated. 454b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * 455b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param s2 Second source string. 456b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param length2 Length of second source string, or -1 if NUL-terminated. 457b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * 458b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param codePointOrder Choose between code unit order (FALSE) 459b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * and code point order (TRUE). 460b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * 461b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @return <0 or 0 or >0 as usual for string comparisons 462b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * 463b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @stable ICU 2.2 464b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru */ 465b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste QueruU_STABLE int32_t U_EXPORT2 466b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queruu_strCompare(const UChar *s1, int32_t length1, 467b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru const UChar *s2, int32_t length2, 468b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru UBool codePointOrder); 469b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru 470b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru/** 471b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * Compare two Unicode strings (binary order) 472b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * as presented by UCharIterator objects. 473b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * Works otherwise just like u_strCompare(). 474b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * 475b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * Both iterators are reset to their start positions. 476b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * When the function returns, it is undefined where the iterators 477b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * have stopped. 478b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * 479b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param iter1 First source string iterator. 480b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param iter2 Second source string iterator. 481b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param codePointOrder Choose between code unit order (FALSE) 482b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * and code point order (TRUE). 483b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * 484b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @return <0 or 0 or >0 as usual for string comparisons 485b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * 486b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @see u_strCompare 487b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * 488b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @stable ICU 2.6 489b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru */ 490b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste QueruU_STABLE int32_t U_EXPORT2 491b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queruu_strCompareIter(UCharIterator *iter1, UCharIterator *iter2, UBool codePointOrder); 492b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru 493b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru#ifndef U_COMPARE_CODE_POINT_ORDER 494b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru/* see also unistr.h and unorm.h */ 495b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru/** 496b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * Option bit for u_strCaseCompare, u_strcasecmp, unorm_compare, etc: 497b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * Compare strings in code point order instead of code unit order. 498b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @stable ICU 2.2 499b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru */ 500b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru#define U_COMPARE_CODE_POINT_ORDER 0x8000 501b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru#endif 502b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru 503b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru/** 504b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * Compare two strings case-insensitively using full case folding. 505b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * This is equivalent to 506b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * u_strCompare(u_strFoldCase(s1, options), 507b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * u_strFoldCase(s2, options), 508b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * (options&U_COMPARE_CODE_POINT_ORDER)!=0). 509b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * 510b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * The comparison can be done in UTF-16 code unit order or in code point order. 511b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * They differ only when comparing supplementary code points (U+10000..U+10ffff) 512b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * to BMP code points near the end of the BMP (i.e., U+e000..U+ffff). 513b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * In code unit order, high BMP code points sort after supplementary code points 514b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * because they are stored as pairs of surrogates which are at U+d800..U+dfff. 515b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * 516b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * This functions works with strings of different explicitly specified lengths 517b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * unlike the ANSI C-like u_strcmp() and u_memcmp() etc. 518b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * NUL-terminated strings are possible with length arguments of -1. 519b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * 520b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param s1 First source string. 521b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param length1 Length of first source string, or -1 if NUL-terminated. 522b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * 523b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param s2 Second source string. 524b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param length2 Length of second source string, or -1 if NUL-terminated. 525b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * 526b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param options A bit set of options: 527b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * - U_FOLD_CASE_DEFAULT or 0 is used for default options: 528b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * Comparison in code unit order with default case folding. 529b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * 530b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * - U_COMPARE_CODE_POINT_ORDER 531b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * Set to choose code point order instead of code unit order 532b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * (see u_strCompare for details). 533b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * 534b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * - U_FOLD_CASE_EXCLUDE_SPECIAL_I 535b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * 536b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param pErrorCode Must be a valid pointer to an error code value, 537b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * which must not indicate a failure before the function call. 538b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * 539b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @return <0 or 0 or >0 as usual for string comparisons 540b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * 541b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @stable ICU 2.2 542b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru */ 543b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste QueruU_STABLE int32_t U_EXPORT2 544b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queruu_strCaseCompare(const UChar *s1, int32_t length1, 545b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru const UChar *s2, int32_t length2, 546b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru uint32_t options, 547b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru UErrorCode *pErrorCode); 548b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru 549b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru/** 550b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * Compare two ustrings for bitwise equality. 551b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * Compares at most <code>n</code> characters. 552b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * 553b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param ucs1 A string to compare. 554b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param ucs2 A string to compare. 555b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param n The maximum number of characters to compare. 556b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @return 0 if <code>s1</code> and <code>s2</code> are bitwise equal; a negative 557b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * value if <code>s1</code> is bitwise less than <code>s2</code>; a positive 558b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * value if <code>s1</code> is bitwise greater than <code>s2</code>. 559b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @stable ICU 2.0 560b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru */ 561b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste QueruU_STABLE int32_t U_EXPORT2 562b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queruu_strncmp(const UChar *ucs1, 563b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru const UChar *ucs2, 564b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru int32_t n); 565b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru 566b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru/** 567b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * Compare two Unicode strings in code point order. 568b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * This is different in UTF-16 from u_strncmp() if supplementary characters are present. 569b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * For details, see u_strCompare(). 570b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * 571b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param s1 A string to compare. 572b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param s2 A string to compare. 573b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param n The maximum number of characters to compare. 574b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @return a negative/zero/positive integer corresponding to whether 575b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * the first string is less than/equal to/greater than the second one 576b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * in code point order 577b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @stable ICU 2.0 578b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru */ 579b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste QueruU_STABLE int32_t U_EXPORT2 580b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queruu_strncmpCodePointOrder(const UChar *s1, const UChar *s2, int32_t n); 581b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru 582b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru/** 583b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * Compare two strings case-insensitively using full case folding. 584b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * This is equivalent to u_strcmp(u_strFoldCase(s1, options), u_strFoldCase(s2, options)). 585b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * 586b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param s1 A string to compare. 587b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param s2 A string to compare. 588b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param options A bit set of options: 589b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * - U_FOLD_CASE_DEFAULT or 0 is used for default options: 590b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * Comparison in code unit order with default case folding. 591b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * 592b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * - U_COMPARE_CODE_POINT_ORDER 593b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * Set to choose code point order instead of code unit order 594b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * (see u_strCompare for details). 595b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * 596b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * - U_FOLD_CASE_EXCLUDE_SPECIAL_I 597b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * 598b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @return A negative, zero, or positive integer indicating the comparison result. 599b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @stable ICU 2.0 600b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru */ 601b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste QueruU_STABLE int32_t U_EXPORT2 602b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queruu_strcasecmp(const UChar *s1, const UChar *s2, uint32_t options); 603b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru 604b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru/** 605b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * Compare two strings case-insensitively using full case folding. 606b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * This is equivalent to u_strcmp(u_strFoldCase(s1, at most n, options), 607b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * u_strFoldCase(s2, at most n, options)). 608b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * 609b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param s1 A string to compare. 610b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param s2 A string to compare. 611b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param n The maximum number of characters each string to case-fold and then compare. 612b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param options A bit set of options: 613b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * - U_FOLD_CASE_DEFAULT or 0 is used for default options: 614b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * Comparison in code unit order with default case folding. 615b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * 616b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * - U_COMPARE_CODE_POINT_ORDER 617b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * Set to choose code point order instead of code unit order 618b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * (see u_strCompare for details). 619b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * 620b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * - U_FOLD_CASE_EXCLUDE_SPECIAL_I 621b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * 622b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @return A negative, zero, or positive integer indicating the comparison result. 623b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @stable ICU 2.0 624b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru */ 625b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste QueruU_STABLE int32_t U_EXPORT2 626b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queruu_strncasecmp(const UChar *s1, const UChar *s2, int32_t n, uint32_t options); 627b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru 628b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru/** 629b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * Compare two strings case-insensitively using full case folding. 630b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * This is equivalent to u_strcmp(u_strFoldCase(s1, n, options), 631b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * u_strFoldCase(s2, n, options)). 632b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * 633b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param s1 A string to compare. 634b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param s2 A string to compare. 635b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param length The number of characters in each string to case-fold and then compare. 636b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param options A bit set of options: 637b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * - U_FOLD_CASE_DEFAULT or 0 is used for default options: 638b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * Comparison in code unit order with default case folding. 639b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * 640b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * - U_COMPARE_CODE_POINT_ORDER 641b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * Set to choose code point order instead of code unit order 642b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * (see u_strCompare for details). 643b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * 644b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * - U_FOLD_CASE_EXCLUDE_SPECIAL_I 645b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * 646b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @return A negative, zero, or positive integer indicating the comparison result. 647b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @stable ICU 2.0 648b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru */ 649b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste QueruU_STABLE int32_t U_EXPORT2 650b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queruu_memcasecmp(const UChar *s1, const UChar *s2, int32_t length, uint32_t options); 651b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru 652b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru/** 653b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * Copy a ustring. Adds a null terminator. 654b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * 655b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param dst The destination string. 656b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param src The source string. 657b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @return A pointer to <code>dst</code>. 658b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @stable ICU 2.0 659b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru */ 660b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste QueruU_STABLE UChar* U_EXPORT2 661b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queruu_strcpy(UChar *dst, 662b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru const UChar *src); 663b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru 664b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru/** 665b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * Copy a ustring. 666b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * Copies at most <code>n</code> characters. The result will be null terminated 667b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * if the length of <code>src</code> is less than <code>n</code>. 668b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * 669b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param dst The destination string. 670b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param src The source string. 671b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param n The maximum number of characters to copy. 672b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @return A pointer to <code>dst</code>. 673b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @stable ICU 2.0 674b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru */ 675b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste QueruU_STABLE UChar* U_EXPORT2 676b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queruu_strncpy(UChar *dst, 677b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru const UChar *src, 678b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru int32_t n); 679b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru 680b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru#if !UCONFIG_NO_CONVERSION 681b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru 682b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru/** 683b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * Copy a byte string encoded in the default codepage to a ustring. 684b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * Adds a null terminator. 685b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * Performs a host byte to UChar conversion 686b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * 687b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param dst The destination string. 688b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param src The source string. 689b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @return A pointer to <code>dst</code>. 690b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @stable ICU 2.0 691b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru */ 692b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste QueruU_STABLE UChar* U_EXPORT2 u_uastrcpy(UChar *dst, 693b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru const char *src ); 694b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru 695b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru/** 696b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * Copy a byte string encoded in the default codepage to a ustring. 697b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * Copies at most <code>n</code> characters. The result will be null terminated 698b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * if the length of <code>src</code> is less than <code>n</code>. 699b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * Performs a host byte to UChar conversion 700b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * 701b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param dst The destination string. 702b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param src The source string. 703b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param n The maximum number of characters to copy. 704b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @return A pointer to <code>dst</code>. 705b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @stable ICU 2.0 706b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru */ 707b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste QueruU_STABLE UChar* U_EXPORT2 u_uastrncpy(UChar *dst, 708b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru const char *src, 709b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru int32_t n); 710b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru 711b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru/** 712b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * Copy ustring to a byte string encoded in the default codepage. 713b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * Adds a null terminator. 714b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * Performs a UChar to host byte conversion 715b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * 716b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param dst The destination string. 717b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param src The source string. 718b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @return A pointer to <code>dst</code>. 719b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @stable ICU 2.0 720b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru */ 721b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste QueruU_STABLE char* U_EXPORT2 u_austrcpy(char *dst, 722b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru const UChar *src ); 723b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru 724b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru/** 725b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * Copy ustring to a byte string encoded in the default codepage. 726b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * Copies at most <code>n</code> characters. The result will be null terminated 727b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * if the length of <code>src</code> is less than <code>n</code>. 728b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * Performs a UChar to host byte conversion 729b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * 730b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param dst The destination string. 731b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param src The source string. 732b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param n The maximum number of characters to copy. 733b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @return A pointer to <code>dst</code>. 734b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @stable ICU 2.0 735b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru */ 736b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste QueruU_STABLE char* U_EXPORT2 u_austrncpy(char *dst, 737b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru const UChar *src, 738b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru int32_t n ); 739b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru 740b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru#endif 741b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru 742b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru/** 743b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * Synonym for memcpy(), but with UChars only. 744b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param dest The destination string 745b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param src The source string 746b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param count The number of characters to copy 747b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @return A pointer to <code>dest</code> 748b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @stable ICU 2.0 749b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru */ 750b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste QueruU_STABLE UChar* U_EXPORT2 751b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queruu_memcpy(UChar *dest, const UChar *src, int32_t count); 752b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru 753b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru/** 754b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * Synonym for memmove(), but with UChars only. 755b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param dest The destination string 756b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param src The source string 757b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param count The number of characters to move 758b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @return A pointer to <code>dest</code> 759b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @stable ICU 2.0 760b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru */ 761b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste QueruU_STABLE UChar* U_EXPORT2 762b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queruu_memmove(UChar *dest, const UChar *src, int32_t count); 763b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru 764b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru/** 765b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * Initialize <code>count</code> characters of <code>dest</code> to <code>c</code>. 766b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * 767b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param dest The destination string. 768b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param c The character to initialize the string. 769b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param count The maximum number of characters to set. 770b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @return A pointer to <code>dest</code>. 771b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @stable ICU 2.0 772b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru */ 773b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste QueruU_STABLE UChar* U_EXPORT2 774b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queruu_memset(UChar *dest, UChar c, int32_t count); 775b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru 776b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru/** 777b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * Compare the first <code>count</code> UChars of each buffer. 778b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * 779b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param buf1 The first string to compare. 780b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param buf2 The second string to compare. 781b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param count The maximum number of UChars to compare. 782b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @return When buf1 < buf2, a negative number is returned. 783b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * When buf1 == buf2, 0 is returned. 784b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * When buf1 > buf2, a positive number is returned. 785b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @stable ICU 2.0 786b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru */ 787b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste QueruU_STABLE int32_t U_EXPORT2 788b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queruu_memcmp(const UChar *buf1, const UChar *buf2, int32_t count); 789b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru 790b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru/** 791b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * Compare two Unicode strings in code point order. 792b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * This is different in UTF-16 from u_memcmp() if supplementary characters are present. 793b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * For details, see u_strCompare(). 794b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * 795b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param s1 A string to compare. 796b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param s2 A string to compare. 797b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param count The maximum number of characters to compare. 798b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @return a negative/zero/positive integer corresponding to whether 799b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * the first string is less than/equal to/greater than the second one 800b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * in code point order 801b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @stable ICU 2.0 802b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru */ 803b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste QueruU_STABLE int32_t U_EXPORT2 804b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queruu_memcmpCodePointOrder(const UChar *s1, const UChar *s2, int32_t count); 805b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru 806b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru/** 807b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * Find the first occurrence of a BMP code point in a string. 808b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * A surrogate code point is found only if its match in the text is not 809b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * part of a surrogate pair. 810b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * A NUL character is found at the string terminator. 811b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * 812b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param s The string to search (contains <code>count</code> UChars). 813b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param c The BMP code point to find. 814b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param count The length of the string. 815b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @return A pointer to the first occurrence of <code>c</code> in <code>s</code> 816b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * or <code>NULL</code> if <code>c</code> is not in <code>s</code>. 817b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @stable ICU 2.0 818b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * 819b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @see u_strchr 820b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @see u_memchr32 821b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @see u_strFindFirst 822b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru */ 823b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste QueruU_STABLE UChar* U_EXPORT2 824b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queruu_memchr(const UChar *s, UChar c, int32_t count); 825b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru 826b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru/** 827b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * Find the first occurrence of a code point in a string. 828b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * A surrogate code point is found only if its match in the text is not 829b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * part of a surrogate pair. 830b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * A NUL character is found at the string terminator. 831b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * 832b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param s The string to search (contains <code>count</code> UChars). 833b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param c The code point to find. 834b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param count The length of the string. 835b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @return A pointer to the first occurrence of <code>c</code> in <code>s</code> 836b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * or <code>NULL</code> if <code>c</code> is not in <code>s</code>. 837b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @stable ICU 2.0 838b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * 839b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @see u_strchr32 840b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @see u_memchr 841b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @see u_strFindFirst 842b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru */ 843b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste QueruU_STABLE UChar* U_EXPORT2 844b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queruu_memchr32(const UChar *s, UChar32 c, int32_t count); 845b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru 846b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru/** 847b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * Find the last occurrence of a BMP code point in a string. 848b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * A surrogate code point is found only if its match in the text is not 849b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * part of a surrogate pair. 850b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * A NUL character is found at the string terminator. 851b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * 852b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param s The string to search (contains <code>count</code> UChars). 853b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param c The BMP code point to find. 854b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param count The length of the string. 855b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @return A pointer to the last occurrence of <code>c</code> in <code>s</code> 856b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * or <code>NULL</code> if <code>c</code> is not in <code>s</code>. 857b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @stable ICU 2.4 858b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * 859b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @see u_strrchr 860b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @see u_memrchr32 861b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @see u_strFindLast 862b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru */ 863b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste QueruU_STABLE UChar* U_EXPORT2 864b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queruu_memrchr(const UChar *s, UChar c, int32_t count); 865b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru 866b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru/** 867b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * Find the last occurrence of a code point in a string. 868b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * A surrogate code point is found only if its match in the text is not 869b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * part of a surrogate pair. 870b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * A NUL character is found at the string terminator. 871b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * 872b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param s The string to search (contains <code>count</code> UChars). 873b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param c The code point to find. 874b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param count The length of the string. 875b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @return A pointer to the last occurrence of <code>c</code> in <code>s</code> 876b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * or <code>NULL</code> if <code>c</code> is not in <code>s</code>. 877b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @stable ICU 2.4 878b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * 879b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @see u_strrchr32 880b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @see u_memrchr 881b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @see u_strFindLast 882b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru */ 883b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste QueruU_STABLE UChar* U_EXPORT2 884b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queruu_memrchr32(const UChar *s, UChar32 c, int32_t count); 885b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru 886b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru/** 887b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * Unicode String literals in C. 888b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * We need one macro to declare a variable for the string 889b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * and to statically preinitialize it if possible, 890b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * and a second macro to dynamically intialize such a string variable if necessary. 891b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * 892b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * The macros are defined for maximum performance. 893b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * They work only for strings that contain "invariant characters", i.e., 894b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * only latin letters, digits, and some punctuation. 895b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * See utypes.h for details. 896b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * 897b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * A pair of macros for a single string must be used with the same 898b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * parameters. 899b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * The string parameter must be a C string literal. 900b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * The length of the string, not including the terminating 901b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * <code>NUL</code>, must be specified as a constant. 902b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * The U_STRING_DECL macro should be invoked exactly once for one 903b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * such string variable before it is used. 904b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * 905b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * Usage: 906b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * <pre> 907b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * U_STRING_DECL(ustringVar1, "Quick-Fox 2", 11); 908b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * U_STRING_DECL(ustringVar2, "jumps 5%", 8); 909b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * static UBool didInit=FALSE; 910b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * 911b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * int32_t function() { 912b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * if(!didInit) { 913b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * U_STRING_INIT(ustringVar1, "Quick-Fox 2", 11); 914b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * U_STRING_INIT(ustringVar2, "jumps 5%", 8); 915b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * didInit=TRUE; 916b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * } 917b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * return u_strcmp(ustringVar1, ustringVar2); 918b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * } 919b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * </pre> 920b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru * 921b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru * Note that the macros will NOT consistently work if their argument is another #define. 922b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru * The following will not work on all platforms, don't use it. 923b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru * 924b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru * <pre> 925b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru * #define GLUCK "Mr. Gluck" 926b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru * U_STRING_DECL(var, GLUCK, 9) 927b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru * U_STRING_INIT(var, GLUCK, 9) 928b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru * </pre> 929b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru * 930b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru * Instead, use the string literal "Mr. Gluck" as the argument to both macro 931b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru * calls. 932b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru * 933b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru * 934b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @stable ICU 2.0 935b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru */ 936b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru#if defined(U_DECLARE_UTF16) 937b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru# define U_STRING_DECL(var, cs, length) static const UChar var[(length)+1]=U_DECLARE_UTF16(cs) 938b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru /**@stable ICU 2.0 */ 939b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru# define U_STRING_INIT(var, cs, length) 940b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru#elif U_SIZEOF_WCHAR_T==U_SIZEOF_UCHAR && (U_CHARSET_FAMILY==U_ASCII_FAMILY || (U_SIZEOF_UCHAR == 2 && defined(U_WCHAR_IS_UTF16))) 941b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru# define U_STRING_DECL(var, cs, length) static const UChar var[(length)+1]=L ## cs 942b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru /**@stable ICU 2.0 */ 943b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru# define U_STRING_INIT(var, cs, length) 944b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru#elif U_SIZEOF_UCHAR==1 && U_CHARSET_FAMILY==U_ASCII_FAMILY 945b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru# define U_STRING_DECL(var, cs, length) static const UChar var[(length)+1]=cs 946b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru /**@stable ICU 2.0 */ 947b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru# define U_STRING_INIT(var, cs, length) 948b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru#else 949b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru# define U_STRING_DECL(var, cs, length) static UChar var[(length)+1] 950b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru /**@stable ICU 2.0 */ 951b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru# define U_STRING_INIT(var, cs, length) u_charsToUChars(cs, var, length+1) 952b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru#endif 953b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru 954b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru/** 955b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * Unescape a string of characters and write the resulting 956b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * Unicode characters to the destination buffer. The following escape 957b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * sequences are recognized: 958b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * 959b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * \\uhhhh 4 hex digits; h in [0-9A-Fa-f] 960b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * \\Uhhhhhhhh 8 hex digits 961b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * \\xhh 1-2 hex digits 962b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * \\x{h...} 1-8 hex digits 963b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * \\ooo 1-3 octal digits; o in [0-7] 964b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * \\cX control-X; X is masked with 0x1F 965b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * 966b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * as well as the standard ANSI C escapes: 967b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * 968b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * \\a => U+0007, \\b => U+0008, \\t => U+0009, \\n => U+000A, 969b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * \\v => U+000B, \\f => U+000C, \\r => U+000D, \\e => U+001B, 97050294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho * \\" => U+0022, \\' => U+0027, \\? => U+003F, \\\\ => U+005C 971b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * 972b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * Anything else following a backslash is generically escaped. For 973b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * example, "[a\\-z]" returns "[a-z]". 974b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * 975b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * If an escape sequence is ill-formed, this method returns an empty 976b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * string. An example of an ill-formed sequence is "\\u" followed by 977b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * fewer than 4 hex digits. 978b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * 979b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * The above characters are recognized in the compiler's codepage, 980b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * that is, they are coded as 'u', '\\', etc. Characters that are 981b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * not parts of escape sequences are converted using u_charsToUChars(). 982b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * 983b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * This function is similar to UnicodeString::unescape() but not 984b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * identical to it. The latter takes a source UnicodeString, so it 985b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * does escape recognition but no conversion. 986b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * 987b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param src a zero-terminated string of invariant characters 988b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param dest pointer to buffer to receive converted and unescaped 989b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * text and, if there is room, a zero terminator. May be NULL for 990b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * preflighting, in which case no UChars will be written, but the 991b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * return value will still be valid. On error, an empty string is 992b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * stored here (if possible). 993b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param destCapacity the number of UChars that may be written at 994b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * dest. Ignored if dest == NULL. 995b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @return the length of unescaped string. 996b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @see u_unescapeAt 997b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @see UnicodeString#unescape() 998b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @see UnicodeString#unescapeAt() 999b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @stable ICU 2.0 1000b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru */ 1001b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste QueruU_STABLE int32_t U_EXPORT2 1002b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queruu_unescape(const char *src, 1003b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru UChar *dest, int32_t destCapacity); 1004b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru 1005b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste QueruU_CDECL_BEGIN 1006b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru/** 1007b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * Callback function for u_unescapeAt() that returns a character of 1008b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * the source text given an offset and a context pointer. The context 1009b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * pointer will be whatever is passed into u_unescapeAt(). 1010b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * 1011b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param offset pointer to the offset that will be passed to u_unescapeAt(). 1012b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param context an opaque pointer passed directly into u_unescapeAt() 1013b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @return the character represented by the escape sequence at 1014b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * offset 1015b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @see u_unescapeAt 1016b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @stable ICU 2.0 1017b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru */ 1018b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Querutypedef UChar (U_CALLCONV *UNESCAPE_CHAR_AT)(int32_t offset, void *context); 1019b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste QueruU_CDECL_END 1020b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru 1021b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru/** 1022b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * Unescape a single sequence. The character at offset-1 is assumed 1023b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * (without checking) to be a backslash. This method takes a callback 1024b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * pointer to a function that returns the UChar at a given offset. By 1025b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * varying this callback, ICU functions are able to unescape char* 1026b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * strings, UnicodeString objects, and UFILE pointers. 1027b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * 1028b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * If offset is out of range, or if the escape sequence is ill-formed, 1029b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * (UChar32)0xFFFFFFFF is returned. See documentation of u_unescape() 1030b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * for a list of recognized sequences. 1031b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * 1032b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param charAt callback function that returns a UChar of the source 1033b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * text given an offset and a context pointer. 1034b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param offset pointer to the offset that will be passed to charAt. 1035b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * The offset value will be updated upon return to point after the 1036b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * last parsed character of the escape sequence. On error the offset 1037b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * is unchanged. 1038b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param length the number of characters in the source text. The 1039b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * last character of the source text is considered to be at offset 1040b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * length-1. 1041b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param context an opaque pointer passed directly into charAt. 1042b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @return the character represented by the escape sequence at 1043b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * offset, or (UChar32)0xFFFFFFFF on error. 1044b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @see u_unescape() 1045b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @see UnicodeString#unescape() 1046b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @see UnicodeString#unescapeAt() 1047b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @stable ICU 2.0 1048b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru */ 1049b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste QueruU_STABLE UChar32 U_EXPORT2 1050b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queruu_unescapeAt(UNESCAPE_CHAR_AT charAt, 1051b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru int32_t *offset, 1052b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru int32_t length, 1053b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru void *context); 1054b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru 1055b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru/** 1056b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * Uppercase the characters in a string. 1057b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * Casing is locale-dependent and context-sensitive. 1058b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * The result may be longer or shorter than the original. 1059b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * The source string and the destination buffer are allowed to overlap. 1060b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * 1061b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param dest A buffer for the result string. The result will be zero-terminated if 1062b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * the buffer is large enough. 1063b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param destCapacity The size of the buffer (number of UChars). If it is 0, then 1064b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * dest may be NULL and the function will only return the length of the result 1065b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * without writing any of the result string. 1066b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param src The original string 1067b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param srcLength The length of the original string. If -1, then src must be zero-terminated. 1068b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param locale The locale to consider, or "" for the root locale or NULL for the default locale. 1069b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param pErrorCode Must be a valid pointer to an error code value, 1070b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * which must not indicate a failure before the function call. 1071b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @return The length of the result string. It may be greater than destCapacity. In that case, 1072b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * only some of the result was written to the destination buffer. 1073b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @stable ICU 2.0 1074b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru */ 1075b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste QueruU_STABLE int32_t U_EXPORT2 1076b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queruu_strToUpper(UChar *dest, int32_t destCapacity, 1077b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru const UChar *src, int32_t srcLength, 1078b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru const char *locale, 1079b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru UErrorCode *pErrorCode); 1080b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru 1081b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru/** 1082b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * Lowercase the characters in a string. 1083b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * Casing is locale-dependent and context-sensitive. 1084b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * The result may be longer or shorter than the original. 1085b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * The source string and the destination buffer are allowed to overlap. 1086b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * 1087b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param dest A buffer for the result string. The result will be zero-terminated if 1088b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * the buffer is large enough. 1089b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param destCapacity The size of the buffer (number of UChars). If it is 0, then 1090b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * dest may be NULL and the function will only return the length of the result 1091b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * without writing any of the result string. 1092b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param src The original string 1093b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param srcLength The length of the original string. If -1, then src must be zero-terminated. 1094b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param locale The locale to consider, or "" for the root locale or NULL for the default locale. 1095b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param pErrorCode Must be a valid pointer to an error code value, 1096b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * which must not indicate a failure before the function call. 1097b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @return The length of the result string. It may be greater than destCapacity. In that case, 1098b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * only some of the result was written to the destination buffer. 1099b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @stable ICU 2.0 1100b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru */ 1101b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste QueruU_STABLE int32_t U_EXPORT2 1102b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queruu_strToLower(UChar *dest, int32_t destCapacity, 1103b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru const UChar *src, int32_t srcLength, 1104b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru const char *locale, 1105b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru UErrorCode *pErrorCode); 1106b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru 1107b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru#if !UCONFIG_NO_BREAK_ITERATION 1108b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru 1109b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru/** 1110b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * Titlecase a string. 1111b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * Casing is locale-dependent and context-sensitive. 1112b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * Titlecasing uses a break iterator to find the first characters of words 1113b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * that are to be titlecased. It titlecases those characters and lowercases 1114b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * all others. 1115b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * 1116b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * The titlecase break iterator can be provided to customize for arbitrary 1117b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * styles, using rules and dictionaries beyond the standard iterators. 1118b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * It may be more efficient to always provide an iterator to avoid 1119b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * opening and closing one for each string. 1120b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * The standard titlecase iterator for the root locale implements the 1121b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * algorithm of Unicode TR 21. 1122b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * 1123b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * This function uses only the setText(), first() and next() methods of the 1124b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * provided break iterator. 1125b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * 1126b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * The result may be longer or shorter than the original. 1127b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * The source string and the destination buffer are allowed to overlap. 1128b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * 1129b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param dest A buffer for the result string. The result will be zero-terminated if 1130b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * the buffer is large enough. 1131b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param destCapacity The size of the buffer (number of UChars). If it is 0, then 1132b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * dest may be NULL and the function will only return the length of the result 1133b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * without writing any of the result string. 1134b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param src The original string 1135b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param srcLength The length of the original string. If -1, then src must be zero-terminated. 1136b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param titleIter A break iterator to find the first characters of words 1137b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * that are to be titlecased. 1138b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * If none is provided (NULL), then a standard titlecase 1139b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * break iterator is opened. 1140b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param locale The locale to consider, or "" for the root locale or NULL for the default locale. 1141b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param pErrorCode Must be a valid pointer to an error code value, 1142b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * which must not indicate a failure before the function call. 1143b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @return The length of the result string. It may be greater than destCapacity. In that case, 1144b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * only some of the result was written to the destination buffer. 1145b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @stable ICU 2.1 1146b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru */ 1147b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste QueruU_STABLE int32_t U_EXPORT2 1148b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queruu_strToTitle(UChar *dest, int32_t destCapacity, 1149b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru const UChar *src, int32_t srcLength, 1150b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru UBreakIterator *titleIter, 1151b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru const char *locale, 1152b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru UErrorCode *pErrorCode); 1153b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru 1154b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru#endif 1155b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru 1156b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru/** 1157b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * Case-fold the characters in a string. 1158b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * Case-folding is locale-independent and not context-sensitive, 1159b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * but there is an option for whether to include or exclude mappings for dotted I 1160b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * and dotless i that are marked with 'I' in CaseFolding.txt. 1161b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * The result may be longer or shorter than the original. 1162b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * The source string and the destination buffer are allowed to overlap. 1163b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * 1164b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param dest A buffer for the result string. The result will be zero-terminated if 1165b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * the buffer is large enough. 1166b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param destCapacity The size of the buffer (number of UChars). If it is 0, then 1167b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * dest may be NULL and the function will only return the length of the result 1168b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * without writing any of the result string. 1169b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param src The original string 1170b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param srcLength The length of the original string. If -1, then src must be zero-terminated. 1171b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param options Either U_FOLD_CASE_DEFAULT or U_FOLD_CASE_EXCLUDE_SPECIAL_I 1172b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param pErrorCode Must be a valid pointer to an error code value, 1173b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * which must not indicate a failure before the function call. 1174b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @return The length of the result string. It may be greater than destCapacity. In that case, 1175b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * only some of the result was written to the destination buffer. 1176b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @stable ICU 2.0 1177b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru */ 1178b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste QueruU_STABLE int32_t U_EXPORT2 1179b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queruu_strFoldCase(UChar *dest, int32_t destCapacity, 1180b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru const UChar *src, int32_t srcLength, 1181b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru uint32_t options, 1182b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru UErrorCode *pErrorCode); 1183b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru 1184b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru#if defined(U_WCHAR_IS_UTF16) || defined(U_WCHAR_IS_UTF32) || !UCONFIG_NO_CONVERSION 1185b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru/** 1186b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru * Convert a UTF-16 string to a wchar_t string. 1187b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru * If it is known at compile time that wchar_t strings are in UTF-16 or UTF-32, then 1188b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru * this function simply calls the fast, dedicated function for that. 1189b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru * Otherwise, two conversions UTF-16 -> default charset -> wchar_t* are performed. 1190b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * 1191b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param dest A buffer for the result string. The result will be zero-terminated if 1192b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * the buffer is large enough. 1193b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param destCapacity The size of the buffer (number of wchar_t's). If it is 0, then 1194b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * dest may be NULL and the function will only return the length of the 1195b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * result without writing any of the result string (pre-flighting). 1196b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param pDestLength A pointer to receive the number of units written to the destination. If 1197b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * pDestLength!=NULL then *pDestLength is always set to the 1198b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * number of output units corresponding to the transformation of 1199b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * all the input units, even in case of a buffer overflow. 1200b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param src The original source string 1201b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param srcLength The length of the original string. If -1, then src must be zero-terminated. 1202b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param pErrorCode Must be a valid pointer to an error code value, 1203b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * which must not indicate a failure before the function call. 1204b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @return The pointer to destination buffer. 1205b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @stable ICU 2.0 1206b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru */ 1207b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste QueruU_STABLE wchar_t* U_EXPORT2 1208b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queruu_strToWCS(wchar_t *dest, 1209b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru int32_t destCapacity, 1210b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru int32_t *pDestLength, 1211b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru const UChar *src, 1212b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru int32_t srcLength, 1213b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru UErrorCode *pErrorCode); 1214b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru/** 1215b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru * Convert a wchar_t string to UTF-16. 1216b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru * If it is known at compile time that wchar_t strings are in UTF-16 or UTF-32, then 1217b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru * this function simply calls the fast, dedicated function for that. 1218b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru * Otherwise, two conversions wchar_t* -> default charset -> UTF-16 are performed. 1219b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * 1220b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param dest A buffer for the result string. The result will be zero-terminated if 1221b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * the buffer is large enough. 1222b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param destCapacity The size of the buffer (number of UChars). If it is 0, then 1223b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * dest may be NULL and the function will only return the length of the 1224b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * result without writing any of the result string (pre-flighting). 1225b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param pDestLength A pointer to receive the number of units written to the destination. If 1226b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * pDestLength!=NULL then *pDestLength is always set to the 1227b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * number of output units corresponding to the transformation of 1228b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * all the input units, even in case of a buffer overflow. 1229b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param src The original source string 1230b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param srcLength The length of the original string. If -1, then src must be zero-terminated. 1231b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param pErrorCode Must be a valid pointer to an error code value, 1232b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * which must not indicate a failure before the function call. 1233b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @return The pointer to destination buffer. 1234b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @stable ICU 2.0 1235b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru */ 1236b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste QueruU_STABLE UChar* U_EXPORT2 1237b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queruu_strFromWCS(UChar *dest, 1238b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru int32_t destCapacity, 1239b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru int32_t *pDestLength, 1240b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru const wchar_t *src, 1241b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru int32_t srcLength, 1242b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru UErrorCode *pErrorCode); 1243b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru#endif /* defined(U_WCHAR_IS_UTF16) || defined(U_WCHAR_IS_UTF32) || !UCONFIG_NO_CONVERSION */ 1244b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru 1245b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru/** 1246b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru * Convert a UTF-16 string to UTF-8. 1247b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru * If the input string is not well-formed, then the U_INVALID_CHAR_FOUND error code is set. 1248b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * 1249b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param dest A buffer for the result string. The result will be zero-terminated if 1250b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * the buffer is large enough. 1251b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param destCapacity The size of the buffer (number of chars). If it is 0, then 1252b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * dest may be NULL and the function will only return the length of the 1253b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * result without writing any of the result string (pre-flighting). 1254b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param pDestLength A pointer to receive the number of units written to the destination. If 1255b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * pDestLength!=NULL then *pDestLength is always set to the 1256b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * number of output units corresponding to the transformation of 1257b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * all the input units, even in case of a buffer overflow. 1258b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param src The original source string 1259b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param srcLength The length of the original string. If -1, then src must be zero-terminated. 1260b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param pErrorCode Must be a valid pointer to an error code value, 1261b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * which must not indicate a failure before the function call. 1262b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @return The pointer to destination buffer. 1263b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @stable ICU 2.0 1264b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @see u_strToUTF8WithSub 1265b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @see u_strFromUTF8 1266b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru */ 1267b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste QueruU_STABLE char* U_EXPORT2 1268b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queruu_strToUTF8(char *dest, 1269b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru int32_t destCapacity, 1270b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru int32_t *pDestLength, 1271b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru const UChar *src, 1272b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru int32_t srcLength, 1273b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru UErrorCode *pErrorCode); 1274b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru 1275b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru/** 1276b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru * Convert a UTF-8 string to UTF-16. 1277b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru * If the input string is not well-formed, then the U_INVALID_CHAR_FOUND error code is set. 1278b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * 1279b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param dest A buffer for the result string. The result will be zero-terminated if 1280b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * the buffer is large enough. 1281b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param destCapacity The size of the buffer (number of UChars). If it is 0, then 1282b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * dest may be NULL and the function will only return the length of the 1283b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * result without writing any of the result string (pre-flighting). 1284b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param pDestLength A pointer to receive the number of units written to the destination. If 1285b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * pDestLength!=NULL then *pDestLength is always set to the 1286b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * number of output units corresponding to the transformation of 1287b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * all the input units, even in case of a buffer overflow. 1288b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param src The original source string 1289b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param srcLength The length of the original string. If -1, then src must be zero-terminated. 1290b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param pErrorCode Must be a valid pointer to an error code value, 1291b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * which must not indicate a failure before the function call. 1292b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @return The pointer to destination buffer. 1293b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @stable ICU 2.0 1294b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @see u_strFromUTF8WithSub 1295b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @see u_strFromUTF8Lenient 1296b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru */ 1297b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste QueruU_STABLE UChar* U_EXPORT2 1298b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queruu_strFromUTF8(UChar *dest, 1299b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru int32_t destCapacity, 1300b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru int32_t *pDestLength, 1301b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru const char *src, 1302b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru int32_t srcLength, 1303b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru UErrorCode *pErrorCode); 1304b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru 1305b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru/** 1306b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru * Convert a UTF-16 string to UTF-8. 1307b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru * If the input string is not well-formed, then the U_INVALID_CHAR_FOUND error code is set. 1308b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru * 1309b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * Same as u_strToUTF8() except for the additional subchar which is output for 1310b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * illegal input sequences, instead of stopping with the U_INVALID_CHAR_FOUND error code. 1311b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * With subchar==U_SENTINEL, this function behaves exactly like u_strToUTF8(). 1312b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * 1313b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param dest A buffer for the result string. The result will be zero-terminated if 1314b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * the buffer is large enough. 1315b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param destCapacity The size of the buffer (number of chars). If it is 0, then 1316b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * dest may be NULL and the function will only return the length of the 1317b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * result without writing any of the result string (pre-flighting). 1318b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param pDestLength A pointer to receive the number of units written to the destination. If 1319b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * pDestLength!=NULL then *pDestLength is always set to the 1320b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * number of output units corresponding to the transformation of 1321b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * all the input units, even in case of a buffer overflow. 1322b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param src The original source string 1323b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param srcLength The length of the original string. If -1, then src must be zero-terminated. 1324b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param subchar The substitution character to use in place of an illegal input sequence, 1325b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * or U_SENTINEL if the function is to return with U_INVALID_CHAR_FOUND instead. 1326b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * A substitution character can be any valid Unicode code point (up to U+10FFFF) 1327b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * except for surrogate code points (U+D800..U+DFFF). 1328b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * The recommended value is U+FFFD "REPLACEMENT CHARACTER". 1329b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param pNumSubstitutions Output parameter receiving the number of substitutions if subchar>=0. 1330b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * Set to 0 if no substitutions occur or subchar<0. 1331b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * pNumSubstitutions can be NULL. 1332b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param pErrorCode Pointer to a standard ICU error code. Its input value must 1333b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * pass the U_SUCCESS() test, or else the function returns 1334b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * immediately. Check for U_FAILURE() on output or use with 1335b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * function chaining. (See User Guide for details.) 1336b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @return The pointer to destination buffer. 1337b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @see u_strToUTF8 1338b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @see u_strFromUTF8WithSub 1339b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @stable ICU 3.6 1340b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru */ 1341b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste QueruU_STABLE char* U_EXPORT2 1342b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queruu_strToUTF8WithSub(char *dest, 1343b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru int32_t destCapacity, 1344b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru int32_t *pDestLength, 1345b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru const UChar *src, 1346b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru int32_t srcLength, 1347b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru UChar32 subchar, int32_t *pNumSubstitutions, 1348b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru UErrorCode *pErrorCode); 1349b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru 1350b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru/** 1351b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru * Convert a UTF-8 string to UTF-16. 1352b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru * If the input string is not well-formed, then the U_INVALID_CHAR_FOUND error code is set. 1353b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru * 1354b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * Same as u_strFromUTF8() except for the additional subchar which is output for 1355b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * illegal input sequences, instead of stopping with the U_INVALID_CHAR_FOUND error code. 1356b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * With subchar==U_SENTINEL, this function behaves exactly like u_strFromUTF8(). 1357b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * 1358b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param dest A buffer for the result string. The result will be zero-terminated if 1359b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * the buffer is large enough. 1360b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param destCapacity The size of the buffer (number of UChars). If it is 0, then 1361b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * dest may be NULL and the function will only return the length of the 1362b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * result without writing any of the result string (pre-flighting). 1363b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param pDestLength A pointer to receive the number of units written to the destination. If 1364b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * pDestLength!=NULL then *pDestLength is always set to the 1365b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * number of output units corresponding to the transformation of 1366b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * all the input units, even in case of a buffer overflow. 1367b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param src The original source string 1368b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param srcLength The length of the original string. If -1, then src must be zero-terminated. 1369b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param subchar The substitution character to use in place of an illegal input sequence, 1370b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * or U_SENTINEL if the function is to return with U_INVALID_CHAR_FOUND instead. 1371b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * A substitution character can be any valid Unicode code point (up to U+10FFFF) 1372b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * except for surrogate code points (U+D800..U+DFFF). 1373b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * The recommended value is U+FFFD "REPLACEMENT CHARACTER". 1374b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param pNumSubstitutions Output parameter receiving the number of substitutions if subchar>=0. 1375b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * Set to 0 if no substitutions occur or subchar<0. 1376b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * pNumSubstitutions can be NULL. 1377b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param pErrorCode Pointer to a standard ICU error code. Its input value must 1378b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * pass the U_SUCCESS() test, or else the function returns 1379b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * immediately. Check for U_FAILURE() on output or use with 1380b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * function chaining. (See User Guide for details.) 1381b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @return The pointer to destination buffer. 1382b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @see u_strFromUTF8 1383b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @see u_strFromUTF8Lenient 1384b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @see u_strToUTF8WithSub 1385b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @stable ICU 3.6 1386b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru */ 1387b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste QueruU_STABLE UChar* U_EXPORT2 1388b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queruu_strFromUTF8WithSub(UChar *dest, 1389b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru int32_t destCapacity, 1390b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru int32_t *pDestLength, 1391b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru const char *src, 1392b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru int32_t srcLength, 1393b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru UChar32 subchar, int32_t *pNumSubstitutions, 1394b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru UErrorCode *pErrorCode); 1395b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru 1396b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru/** 1397b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru * Convert a UTF-8 string to UTF-16. 1398b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru * 1399b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * Same as u_strFromUTF8() except that this function is designed to be very fast, 1400b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * which it achieves by being lenient about malformed UTF-8 sequences. 1401b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * This function is intended for use in environments where UTF-8 text is 1402b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * expected to be well-formed. 1403b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * 1404b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * Its semantics are: 1405b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * - Well-formed UTF-8 text is correctly converted to well-formed UTF-16 text. 1406b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * - The function will not read beyond the input string, nor write beyond 1407b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * the destCapacity. 1408b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * - Malformed UTF-8 results in "garbage" 16-bit Unicode strings which may not 1409b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * be well-formed UTF-16. 1410b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * The function will resynchronize to valid code point boundaries 1411b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * within a small number of code points after an illegal sequence. 1412b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * - Non-shortest forms are not detected and will result in "spoofing" output. 1413b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * 1414b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * For further performance improvement, if srcLength is given (>=0), 1415b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * then it must be destCapacity>=srcLength. 1416b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * 1417b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru * There is no inverse u_strToUTF8Lenient() function because there is practically 1418b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru * no performance gain from not checking that a UTF-16 string is well-formed. 1419b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru * 1420b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param dest A buffer for the result string. The result will be zero-terminated if 1421b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * the buffer is large enough. 1422b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param destCapacity The size of the buffer (number of UChars). If it is 0, then 1423b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * dest may be NULL and the function will only return the length of the 1424b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * result without writing any of the result string (pre-flighting). 1425b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * Unlike for other ICU functions, if srcLength>=0 then it 1426b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * must be destCapacity>=srcLength. 1427b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param pDestLength A pointer to receive the number of units written to the destination. If 1428b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * pDestLength!=NULL then *pDestLength is always set to the 1429b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * number of output units corresponding to the transformation of 1430b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * all the input units, even in case of a buffer overflow. 1431b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * Unlike for other ICU functions, if srcLength>=0 but 1432b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * destCapacity<srcLength, then *pDestLength will be set to srcLength 1433b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * (and U_BUFFER_OVERFLOW_ERROR will be set) 1434b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * regardless of the actual result length. 1435b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param src The original source string 1436b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param srcLength The length of the original string. If -1, then src must be zero-terminated. 1437b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param pErrorCode Pointer to a standard ICU error code. Its input value must 1438b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * pass the U_SUCCESS() test, or else the function returns 1439b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * immediately. Check for U_FAILURE() on output or use with 1440b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * function chaining. (See User Guide for details.) 1441b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @return The pointer to destination buffer. 1442b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @see u_strFromUTF8 1443b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @see u_strFromUTF8WithSub 1444b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @see u_strToUTF8WithSub 1445b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @stable ICU 3.6 1446b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru */ 1447b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste QueruU_STABLE UChar * U_EXPORT2 1448b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queruu_strFromUTF8Lenient(UChar *dest, 1449b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru int32_t destCapacity, 1450b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru int32_t *pDestLength, 1451b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru const char *src, 1452b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru int32_t srcLength, 1453b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru UErrorCode *pErrorCode); 1454b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru 1455b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru/** 1456b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru * Convert a UTF-16 string to UTF-32. 1457b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru * If the input string is not well-formed, then the U_INVALID_CHAR_FOUND error code is set. 1458b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * 1459b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param dest A buffer for the result string. The result will be zero-terminated if 1460b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * the buffer is large enough. 1461b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param destCapacity The size of the buffer (number of UChar32s). If it is 0, then 1462b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * dest may be NULL and the function will only return the length of the 1463b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * result without writing any of the result string (pre-flighting). 1464b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param pDestLength A pointer to receive the number of units written to the destination. If 1465b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * pDestLength!=NULL then *pDestLength is always set to the 1466b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * number of output units corresponding to the transformation of 1467b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * all the input units, even in case of a buffer overflow. 1468b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param src The original source string 1469b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param srcLength The length of the original string. If -1, then src must be zero-terminated. 1470b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param pErrorCode Must be a valid pointer to an error code value, 1471b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * which must not indicate a failure before the function call. 1472b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @return The pointer to destination buffer. 1473b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru * @see u_strToUTF32WithSub 1474b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru * @see u_strFromUTF32 1475b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @stable ICU 2.0 1476b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru */ 1477b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste QueruU_STABLE UChar32* U_EXPORT2 1478b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queruu_strToUTF32(UChar32 *dest, 1479b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru int32_t destCapacity, 1480b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru int32_t *pDestLength, 1481b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru const UChar *src, 1482b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru int32_t srcLength, 1483b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru UErrorCode *pErrorCode); 1484b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru 1485b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru/** 1486b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru * Convert a UTF-32 string to UTF-16. 1487b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru * If the input string is not well-formed, then the U_INVALID_CHAR_FOUND error code is set. 1488b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * 1489b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param dest A buffer for the result string. The result will be zero-terminated if 1490b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * the buffer is large enough. 1491b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param destCapacity The size of the buffer (number of UChars). If it is 0, then 1492b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * dest may be NULL and the function will only return the length of the 1493b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * result without writing any of the result string (pre-flighting). 1494b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param pDestLength A pointer to receive the number of units written to the destination. If 1495b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * pDestLength!=NULL then *pDestLength is always set to the 1496b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * number of output units corresponding to the transformation of 1497b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * all the input units, even in case of a buffer overflow. 1498b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param src The original source string 1499b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param srcLength The length of the original string. If -1, then src must be zero-terminated. 1500b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param pErrorCode Must be a valid pointer to an error code value, 1501b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * which must not indicate a failure before the function call. 1502b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @return The pointer to destination buffer. 1503b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru * @see u_strFromUTF32WithSub 1504b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru * @see u_strToUTF32 1505b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @stable ICU 2.0 1506b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru */ 1507b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste QueruU_STABLE UChar* U_EXPORT2 1508b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queruu_strFromUTF32(UChar *dest, 1509b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru int32_t destCapacity, 1510b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru int32_t *pDestLength, 1511b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru const UChar32 *src, 1512b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru int32_t srcLength, 1513b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru UErrorCode *pErrorCode); 1514b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru 1515b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru/** 1516b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru * Convert a UTF-16 string to UTF-32. 1517b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru * If the input string is not well-formed, then the U_INVALID_CHAR_FOUND error code is set. 1518b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru * 1519b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru * Same as u_strToUTF32() except for the additional subchar which is output for 1520b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru * illegal input sequences, instead of stopping with the U_INVALID_CHAR_FOUND error code. 1521b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru * With subchar==U_SENTINEL, this function behaves exactly like u_strToUTF32(). 1522b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru * 1523b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru * @param dest A buffer for the result string. The result will be zero-terminated if 1524b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru * the buffer is large enough. 1525b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru * @param destCapacity The size of the buffer (number of UChar32s). If it is 0, then 1526b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru * dest may be NULL and the function will only return the length of the 1527b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru * result without writing any of the result string (pre-flighting). 1528b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru * @param pDestLength A pointer to receive the number of units written to the destination. If 1529b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru * pDestLength!=NULL then *pDestLength is always set to the 1530b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru * number of output units corresponding to the transformation of 1531b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru * all the input units, even in case of a buffer overflow. 1532b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru * @param src The original source string 1533b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru * @param srcLength The length of the original string. If -1, then src must be zero-terminated. 1534b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru * @param subchar The substitution character to use in place of an illegal input sequence, 1535b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru * or U_SENTINEL if the function is to return with U_INVALID_CHAR_FOUND instead. 1536b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru * A substitution character can be any valid Unicode code point (up to U+10FFFF) 1537b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru * except for surrogate code points (U+D800..U+DFFF). 1538b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru * The recommended value is U+FFFD "REPLACEMENT CHARACTER". 1539b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru * @param pNumSubstitutions Output parameter receiving the number of substitutions if subchar>=0. 1540b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru * Set to 0 if no substitutions occur or subchar<0. 1541b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru * pNumSubstitutions can be NULL. 1542b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru * @param pErrorCode Pointer to a standard ICU error code. Its input value must 1543b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru * pass the U_SUCCESS() test, or else the function returns 1544b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru * immediately. Check for U_FAILURE() on output or use with 1545b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru * function chaining. (See User Guide for details.) 1546b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru * @return The pointer to destination buffer. 1547b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru * @see u_strToUTF32 1548b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru * @see u_strFromUTF32WithSub 154950294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho * @stable ICU 4.2 1550b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru */ 155150294ead5e5d23f5bbfed76e00e6b510bd41eee1clairehoU_STABLE UChar32* U_EXPORT2 1552b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queruu_strToUTF32WithSub(UChar32 *dest, 1553b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru int32_t destCapacity, 1554b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru int32_t *pDestLength, 1555b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru const UChar *src, 1556b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru int32_t srcLength, 1557b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru UChar32 subchar, int32_t *pNumSubstitutions, 1558b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru UErrorCode *pErrorCode); 1559b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru 1560b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru/** 1561b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru * Convert a UTF-32 string to UTF-16. 1562b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru * If the input string is not well-formed, then the U_INVALID_CHAR_FOUND error code is set. 1563b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru * 1564b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru * Same as u_strFromUTF32() except for the additional subchar which is output for 1565b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru * illegal input sequences, instead of stopping with the U_INVALID_CHAR_FOUND error code. 1566b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru * With subchar==U_SENTINEL, this function behaves exactly like u_strFromUTF32(). 1567b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru * 1568b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru * @param dest A buffer for the result string. The result will be zero-terminated if 1569b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru * the buffer is large enough. 1570b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru * @param destCapacity The size of the buffer (number of UChars). If it is 0, then 1571b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru * dest may be NULL and the function will only return the length of the 1572b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru * result without writing any of the result string (pre-flighting). 1573b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru * @param pDestLength A pointer to receive the number of units written to the destination. If 1574b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru * pDestLength!=NULL then *pDestLength is always set to the 1575b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru * number of output units corresponding to the transformation of 1576b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru * all the input units, even in case of a buffer overflow. 1577b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru * @param src The original source string 1578b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru * @param srcLength The length of the original string. If -1, then src must be zero-terminated. 1579b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru * @param subchar The substitution character to use in place of an illegal input sequence, 1580b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru * or U_SENTINEL if the function is to return with U_INVALID_CHAR_FOUND instead. 1581b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru * A substitution character can be any valid Unicode code point (up to U+10FFFF) 1582b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru * except for surrogate code points (U+D800..U+DFFF). 1583b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru * The recommended value is U+FFFD "REPLACEMENT CHARACTER". 1584b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru * @param pNumSubstitutions Output parameter receiving the number of substitutions if subchar>=0. 1585b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru * Set to 0 if no substitutions occur or subchar<0. 1586b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru * pNumSubstitutions can be NULL. 1587b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru * @param pErrorCode Pointer to a standard ICU error code. Its input value must 1588b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru * pass the U_SUCCESS() test, or else the function returns 1589b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru * immediately. Check for U_FAILURE() on output or use with 1590b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru * function chaining. (See User Guide for details.) 1591b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru * @return The pointer to destination buffer. 1592b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru * @see u_strFromUTF32 1593b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru * @see u_strToUTF32WithSub 159450294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho * @stable ICU 4.2 1595b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru */ 159650294ead5e5d23f5bbfed76e00e6b510bd41eee1clairehoU_STABLE UChar* U_EXPORT2 1597b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queruu_strFromUTF32WithSub(UChar *dest, 1598b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru int32_t destCapacity, 1599b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru int32_t *pDestLength, 1600b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru const UChar32 *src, 1601b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru int32_t srcLength, 1602b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru UChar32 subchar, int32_t *pNumSubstitutions, 1603b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru UErrorCode *pErrorCode); 1604b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru 160550294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho/** 160650294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho * Convert a 16-bit Unicode string to Java Modified UTF-8. 160750294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho * See http://java.sun.com/javase/6/docs/api/java/io/DataInput.html#modified-utf-8 160850294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho * 160950294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho * This function behaves according to the documentation for Java DataOutput.writeUTF() 161050294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho * except that it does not encode the output length in the destination buffer 161150294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho * and does not have an output length restriction. 161250294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho * See http://java.sun.com/javase/6/docs/api/java/io/DataOutput.html#writeUTF(java.lang.String) 161350294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho * 161450294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho * The input string need not be well-formed UTF-16. 161550294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho * (Therefore there is no subchar parameter.) 161650294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho * 161750294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho * @param dest A buffer for the result string. The result will be zero-terminated if 161850294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho * the buffer is large enough. 161950294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho * @param destCapacity The size of the buffer (number of chars). If it is 0, then 162050294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho * dest may be NULL and the function will only return the length of the 162150294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho * result without writing any of the result string (pre-flighting). 162250294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho * @param pDestLength A pointer to receive the number of units written to the destination. If 162350294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho * pDestLength!=NULL then *pDestLength is always set to the 162450294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho * number of output units corresponding to the transformation of 162550294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho * all the input units, even in case of a buffer overflow. 162650294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho * @param src The original source string 162750294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho * @param srcLength The length of the original string. If -1, then src must be zero-terminated. 162850294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho * @param pErrorCode Pointer to a standard ICU error code. Its input value must 162950294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho * pass the U_SUCCESS() test, or else the function returns 163050294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho * immediately. Check for U_FAILURE() on output or use with 163150294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho * function chaining. (See User Guide for details.) 163250294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho * @return The pointer to destination buffer. 163327f654740f2a26ad62a5c155af9199af9e69b889claireho * @stable ICU 4.4 163450294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho * @see u_strToUTF8WithSub 163550294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho * @see u_strFromJavaModifiedUTF8WithSub 163650294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho */ 163727f654740f2a26ad62a5c155af9199af9e69b889clairehoU_STABLE char* U_EXPORT2 163850294ead5e5d23f5bbfed76e00e6b510bd41eee1clairehou_strToJavaModifiedUTF8( 163950294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho char *dest, 164050294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho int32_t destCapacity, 164150294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho int32_t *pDestLength, 164250294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho const UChar *src, 164350294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho int32_t srcLength, 164450294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho UErrorCode *pErrorCode); 164550294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho 164650294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho/** 164750294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho * Convert a Java Modified UTF-8 string to a 16-bit Unicode string. 164850294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho * If the input string is not well-formed, then the U_INVALID_CHAR_FOUND error code is set. 164950294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho * 165050294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho * This function behaves according to the documentation for Java DataInput.readUTF() 165150294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho * except that it takes a length parameter rather than 165250294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho * interpreting the first two input bytes as the length. 165350294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho * See http://java.sun.com/javase/6/docs/api/java/io/DataInput.html#readUTF() 165450294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho * 165550294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho * The output string may not be well-formed UTF-16. 165650294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho * 165750294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho * @param dest A buffer for the result string. The result will be zero-terminated if 165850294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho * the buffer is large enough. 165950294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho * @param destCapacity The size of the buffer (number of UChars). If it is 0, then 166050294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho * dest may be NULL and the function will only return the length of the 166150294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho * result without writing any of the result string (pre-flighting). 166250294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho * @param pDestLength A pointer to receive the number of units written to the destination. If 166350294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho * pDestLength!=NULL then *pDestLength is always set to the 166450294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho * number of output units corresponding to the transformation of 166550294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho * all the input units, even in case of a buffer overflow. 166650294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho * @param src The original source string 166750294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho * @param srcLength The length of the original string. If -1, then src must be zero-terminated. 166850294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho * @param subchar The substitution character to use in place of an illegal input sequence, 166950294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho * or U_SENTINEL if the function is to return with U_INVALID_CHAR_FOUND instead. 167050294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho * A substitution character can be any valid Unicode code point (up to U+10FFFF) 167150294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho * except for surrogate code points (U+D800..U+DFFF). 167250294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho * The recommended value is U+FFFD "REPLACEMENT CHARACTER". 167350294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho * @param pNumSubstitutions Output parameter receiving the number of substitutions if subchar>=0. 167450294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho * Set to 0 if no substitutions occur or subchar<0. 167550294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho * pNumSubstitutions can be NULL. 167650294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho * @param pErrorCode Pointer to a standard ICU error code. Its input value must 167750294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho * pass the U_SUCCESS() test, or else the function returns 167850294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho * immediately. Check for U_FAILURE() on output or use with 167950294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho * function chaining. (See User Guide for details.) 168050294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho * @return The pointer to destination buffer. 168150294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho * @see u_strFromUTF8WithSub 168250294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho * @see u_strFromUTF8Lenient 168350294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho * @see u_strToJavaModifiedUTF8 168427f654740f2a26ad62a5c155af9199af9e69b889claireho * @stable ICU 4.4 168550294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho */ 168627f654740f2a26ad62a5c155af9199af9e69b889clairehoU_STABLE UChar* U_EXPORT2 168750294ead5e5d23f5bbfed76e00e6b510bd41eee1clairehou_strFromJavaModifiedUTF8WithSub( 168850294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho UChar *dest, 168950294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho int32_t destCapacity, 169050294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho int32_t *pDestLength, 169150294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho const char *src, 169250294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho int32_t srcLength, 169350294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho UChar32 subchar, int32_t *pNumSubstitutions, 169450294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho UErrorCode *pErrorCode); 169550294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho 1696b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru#endif 1697