#include "unicode/utypes.h"
Go to the source code of this file.
Defines | |
#define | U_STRING_DECL(var, cs, length) static const wchar_t var[(length)+1]={ L ## cs } |
Unicode String literals in C. More... | |
#define | U_STRING_INIT(var, cs, length) |
Functions | |
U_CAPI int32_t U_EXPORT2 | u_strlen (const UChar *s) |
Determine the length of an array of UChar. More... | |
U_CAPI UChar* U_EXPORT2 | u_strcat (UChar *dst, const UChar *src) |
Concatenate two ustrings. More... | |
U_CAPI UChar* U_EXPORT2 | u_strncat (UChar *dst, const UChar *src, int32_t n) |
Concatenate two ustrings. More... | |
U_CAPI UChar* U_EXPORT2 | u_strchr (const UChar *s, UChar c) |
Find the first occurrence of a specified character in a ustring. More... | |
U_CAPI UChar* U_EXPORT2 | u_strstr (const UChar *s, const UChar *substring) |
Find the first occurrence of a substring in a string. More... | |
U_CAPI UChar* U_EXPORT2 | u_strchr32 (const UChar *s, UChar32 c) |
Find the first occurence of a specified code point in a string. More... | |
U_CAPI int32_t U_EXPORT2 | u_strcmp (const UChar *s1, const UChar *s2) |
Compare two ustrings for bitwise equality. More... | |
U_CAPI int32_t U_EXPORT2 | u_strncmp (const UChar *ucs1, const UChar *ucs2, int32_t n) |
Compare two ustrings for bitwise equality. More... | |
U_CAPI UChar* U_EXPORT2 | u_strcpy (UChar *dst, const UChar *src) |
Copy a ustring. More... | |
U_CAPI UChar* U_EXPORT2 | u_strncpy (UChar *dst, const UChar *src, int32_t n) |
Copy a ustring. More... | |
U_CAPI UChar* U_EXPORT2 | u_uastrcpy (UChar *ucs1, const char *s2 ) |
Copy a byte string encoded in the default codepage to a ustring. More... | |
U_CAPI UChar* U_EXPORT2 | u_uastrncpy (UChar *ucs1, const char *s2, int32_t n) |
Copy a byte string encoded in the default codepage to a ustring. More... | |
U_CAPI char* U_EXPORT2 | u_austrcpy (char *s1, const UChar *us2 ) |
Copy ustring to a byte string encoded in the default codepage. More... | |
U_CAPI int32_t U_EXPORT2 | u_unescape (const char *src, UChar *dest, int32_t destCapacity) |
Unescape a string of characters and write the resulting Unicode characters to the destination buffer. More... | |
U_CDECL_END U_CAPI UChar32 U_EXPORT2 | u_unescapeAt (UNESCAPE_CHAR_AT charAt, int32_t *offset, int32_t length, void *context) |
Unescape a single sequence. More... | |
U_CAPI int32_t U_EXPORT2 | u_strToUpper (const UChar *src, int32_t srcLength, UChar *dest, int32_t destCapacity, const char *locale, UErrorCode *pErrorCode) |
Uppercase the characters in a string. More... | |
U_CAPI int32_t U_EXPORT2 | u_strToLower (const UChar *src, int32_t srcLength, UChar *dest, int32_t destCapacity, const char *locale, UErrorCode *pErrorCode) |
Lowercase the characters in a string. More... | |
Variables | |
U_CDECL_BEGIN typedef UChar (* | UNESCAPE_CHAR_AT )(int32_t offset, void *context) |
Callback function for u_unescapeAt() that returns a character of the source text given an offset and a context pointer. More... |
|
Unicode String literals in C. We need one macro to declare a variable for the string and to statically preinitialize it if possible, and a second macro to dynamically intialize such a string variable if necessary. The macros are defined for maximum performance. They work only for strings that contain "invariant characters", i.e., only latin letters, digits, and some punctuation. See utypes.h for details.
A pair of macros for a single string must be used with the same parameters. The string parameter must be a C string literal. The length of the string, not including the terminating Usage:   U_STRING_DECL(ustringVar1, "Quick-Fox 2", 11);   U_STRING_DECL(ustringVar2, "jumps 5%", 8);   static UBool didInit=FALSE;     int32_t function() {   if(!didInit) {   U_STRING_INIT(ustringVar1, "Quick-Fox 2", 11);   U_STRING_INIT(ustringVar2, "jumps 5%", 8);   didInit=TRUE;   }   return u_strcmp(ustringVar1, ustringVar2);   } |
|
|
|
Copy ustring to a byte string encoded in the default codepage. Adds a null terminator. performs a UChar to host byte conversion
|
|
Lowercase the characters in a string. Casing is locale-dependent and context-sensitive. The result may be longer or shorter than the original.
|
|
Uppercase the characters in a string. Casing is locale-dependent and context-sensitive. The result may be longer or shorter than the original.
|
|
Concatenate two ustrings.
Appends a copy of
|
|
Find the first occurrence of a specified character in a ustring.
|
|
Find the first occurence of a specified code point in a string.
|
|
Compare two ustrings for bitwise equality.
|
|
Copy a ustring. Adds a null terminator.
|
|
Determine the length of an array of UChar.
|
|
Concatenate two ustrings.
Appends at most
|
|
Compare two ustrings for bitwise equality.
Compares at most
|
|
Copy a ustring.
Copies at most
|
|
Find the first occurrence of a substring in a string.
|
|
Copy a byte string encoded in the default codepage to a ustring. Adds a null terminator. performs a host byte to UChar conversion
|
|
Copy a byte string encoded in the default codepage to a ustring.
Copies at most
|
|
Unescape a string of characters and write the resulting Unicode characters to the destination buffer. The following escape sequences are recognized: \uhhhh 4 hex digits; h in [0-9A-Fa-f] \Uhhhhhhhh 8 hex digits \xhh 1-2 hex digits \ooo 1-3 octal digits; o in [0-7] as well as the standard ANSI C escapes:
=> U+0007, => U+0008, \t => U+0009, Anything else following a backslash is generically escaped. For example, "[a\-z]" returns "[a-z]". If an escape sequence is ill-formed, this method returns an empty string. An example of an ill-formed sequence is "\u" followed by fewer than 4 hex digits. The above characters are recognized in the compiler's codepage, that is, they are coded as 'u', '\', etc. Characters that are not parts of escape sequences are converted using u_charsToUChars(). This function is similar to UnicodeString::unescape() but not identical to it. The latter takes a source UnicodeString, so it does escape recognition but no conversion.
|
|
Unescape a single sequence. The character at offset-1 is assumed (without checking) to be a backslash. This method takes a callback pointer to a function that returns the UChar at a given offset. By varying this callback, ICU functions are able to unescape char* strings, UnicodeString objects, and UFILE pointers. If offset is out of range, or if the escape sequence is ill-formed, (UChar32)0xFFFFFFFF is returned. See documentation of u_unescape() for a list of recognized sequences.
|
|
Callback function for u_unescapeAt() that returns a character of the source text given an offset and a context pointer. The context pointer will be whatever is passed into u_unescapeAt().
|