Defines | |||
![]() | ![]() | #define | U_STRING_DECL (var, cs, length) |
![]() | ![]() | 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 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... |
#define U_STRING_DECL (var, cs, length) |
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 NUL
, must be specified as a constant. The U_STRING_DECL macro should be invoked exactly once for one such string variable before it is used.
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);   }
#define U_STRING_INIT (var, cs, length) |
U_CAPI int32_t U_EXPORT2 u_strlen (const UChar * s) |
Determine the length of an array of UChar.
s | The array of UChars, NULL (U+0000) terminated. |
chars
, minus the terminator. U_CAPI UChar *U_EXPORT2 u_strcat (UChar * dst, const UChar * src) |
Concatenate two ustrings.
Appends a copy of src
, including the null terminator, to dst
. The initial copied character from src
overwrites the null terminator in dst
.
dst | The destination string. |
src | The source string. |
dst
. U_CAPI UChar *U_EXPORT2 u_strncat (UChar * dst, const UChar * src, int32_t n) |
Concatenate two ustrings.
Appends at most n
characters from src
to dst
. Adds a null terminator.
dst | The destination string. |
src | The source string. |
n | The maximum number of characters to compare. |
dst
. U_CAPI UChar *U_EXPORT2 u_strchr (const UChar * s, UChar c) |
Find the first occurrence of a specified character in a ustring.
s | The string to search. |
c | The character to find. |
c
in s
, or a null pointer if s
does not contain c
. U_CAPI int32_t U_EXPORT2 u_strcmp (const UChar * s1, const UChar * s2) |
Compare two ustrings for bitwise equality.
s1 | A string to compare. |
s2 | A string to compare. |
s1
and s2
are bitwise equal; a negative value if s1
is bitwise less than s2,/TT>; a positive value if s1
is bitwise greater than s2,/TT>.
-
Stable:
-
U_CAPI int32_t U_EXPORT2 u_strncmp (const UChar * ucs1, const UChar * ucs2, int32_t n)
Compare two ustrings for bitwise equality.
Compares at most n
characters.
-
Parameters:
-
s1
A string to compare.
s2
A string to compare.
n
The maximum number of characters to compare.
-
Returns:
-
0 if
s1
and s2
are bitwise equal; a negative value if s1
is bitwise less than s2,/TT>; a positive value if s1
is bitwise greater than s2,/TT>.
-
Stable:
-
U_CAPI UChar *U_EXPORT2 u_strcpy (UChar * dst, const UChar * src)
Copy a ustring.
Adds a null terminator.
-
Parameters:
-
dst
The destination string.
src
The source string.
-
Returns:
-
A pointer to
dst
.
-
Stable:
-
U_CAPI UChar *U_EXPORT2 u_strncpy (UChar * dst, const UChar * src, int32_t n)
Copy a ustring.
Copies at most n
characters. The result will be null terminated if the length of src
is less than n
.
-
Parameters:
-
dst
The destination string.
src
The source string.
n
The maximum number of characters to copy.
-
Returns:
-
A pointer to
dst
.
-
Stable:
-
U_CAPI UChar *U_EXPORT2 u_uastrcpy (UChar * ucs1, const char * s2)
Copy a byte string encoded in the default codepage to a ustring.
Adds a null terminator. performs a host byte to UChar conversion
-
Parameters:
-
dst
The destination string.
src
The source string.
-
Returns:
-
A pointer to
dst
.
-
Stable:
-
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.
Copies at most n
characters. The result will be null terminated if the length of src
is less than n
. performs a host byte to UChar conversion
-
Parameters:
-
dst
The destination string.
src
The source string.
n
The maximum number of characters to copy.
-
Returns:
-
A pointer to
dst
.
-
Stable:
-
U_CAPI char *U_EXPORT2 u_austrcpy (char * s1, const UChar * us2)
Copy ustring to a byte string encoded in the default codepage.
Adds a null terminator. performs a UChar to host byte conversion
-
Parameters:
-
dst
The destination string.
src
The source string.
-
Returns:
-
A pointer to
dst
.
-
Stable:
-
Generated at Mon Jun 5 12:53:01 2000 for ICU1.5 by
1.0.0 written by Dimitri van Heesch,
© 1997-1999