Main Page   Class Hierarchy   Compound List   File List   Header Files   Sources   Compound Members   File Members  

UnicodeString Class Reference

UnicodeString is a concrete implementation of the abstract class Replaceable. More...

#include <unistr.h>

Class diagram for UnicodeString:

Replaceable

List of all members.


Public Members

UBool operator== (const UnicodeString& text) const
Equality operator. More...

UBool operator!= (const UnicodeString& text) const
Inequality operator. More...

UBool operator> (const UnicodeString& text) const
Greater than operator. More...

UBool operator< (const UnicodeString& text) const
Less than operator. More...

UBool operator>= (const UnicodeString& text) const
Greater than or equal operator. More...

UBool operator<= (const UnicodeString& text) const
Less than or equal operator. More...

int8_t compare (const UnicodeString& text) const
Compare the characters bitwise in this UnicodeString to the characters in text. More...

int8_t compare (UTextOffset start, int32_t length, const UnicodeString& srcText) const
Compare the characters bitwise in the range [start, start + length) with the characters in srcText. More...

int8_t compare (UTextOffset start, int32_t length, const UnicodeString& srcText, UTextOffset srcStart, int32_t srcLength) const
Compare the characters bitwise in the range [start, start + length) with the characters in srcText in the range [srcStart, srcStart + srcLength). More...

int8_t compare (const UChar *srcChars, int32_t srcLength) const
Compare the characters bitwise in this UnicodeString with the first srcLength characters in srcChars. More...

int8_t compare (UTextOffset start, int32_t length, const UChar *srcChars) const
Compare the characters bitwise in the range [start, start + length) with the first length characters in srcChars. More...

int8_t compare (UTextOffset start, int32_t length, const UChar *srcChars, UTextOffset srcStart, int32_t srcLength) const
Compare the characters bitwise in the range [start, start + length) with the characters in srcChars in the range [srcStart, srcStart + srcLength). More...

int8_t compareBetween (UTextOffset start, UTextOffset limit, const UnicodeString& srcText, UTextOffset srcStart, UTextOffset srcLimit) const
Compare the characters bitwise in the range [start, limit) with the characters in srcText in the range [srcStart, srcLimit). More...

UBool startsWith (const UnicodeString& text) const
Determine if this starts with the characters in text. More...

UBool startsWith (const UnicodeString& srcText, UTextOffset srcStart, int32_t srcLength) const
Determine if this starts with the characters in srcText in the range [srcStart, srcStart + srcLength). More...

UBool startsWith (const UChar *srcChars, int32_t srcLength) const
Determine if this starts with the characters in srcChars. More...

UBool startsWith (const UChar *srcChars, UTextOffset srcStart, int32_t srcLength) const
Determine if this ends with the characters in srcChars in the range [srcStart, srcStart + srcLength). More...

UBool endsWith (const UnicodeString& text) const
Determine if this ends with the characters in text. More...

UBool endsWith (const UnicodeString& srcText, UTextOffset srcStart, int32_t srcLength) const
Determine if this ends with the characters in srcText in the range [srcStart, srcStart + srcLength). More...

UBool endsWith (const UChar *srcChars, int32_t srcLength) const
Determine if this ends with the characters in srcChars. More...

UBool endsWith (const UChar *srcChars, UTextOffset srcStart, int32_t srcLength) const
Determine if this ends with the characters in srcChars in the range [srcStart, srcStart + srcLength). More...

UTextOffset indexOf (const UnicodeString& text) const
Locate in this the first occurrence of the characters in text, using bitwise comparison. More...

UTextOffset indexOf (const UnicodeString& text, UTextOffset start) const
Locate in this the first occurrence of the characters in text starting at offset start, using bitwise comparison. More...

UTextOffset indexOf (const UnicodeString& text, UTextOffset start, int32_t length) const
Locate in this the first occurrence in the range [start, start + length) of the characters in text, using bitwise comparison. More...

UTextOffset indexOf (const UnicodeString& srcText, UTextOffset srcStart, int32_t srcLength, UTextOffset start, int32_t length) const
Locate in this the first occurrence in the range [start, start + length) of the characters in srcText in the range [srcStart, srcStart + srcLength), using bitwise comparison. More...

UTextOffset indexOf (const UChar *srcChars, int32_t srcLength, UTextOffset start) const
Locate in this the first occurrence of the characters in srcChars starting at offset start, using bitwise comparison. More...

UTextOffset indexOf (const UChar *srcChars, int32_t srcLength, UTextOffset start, int32_t length) const
Locate in this the first occurrence in the range [start, start + length) of the characters in srcChars, using bitwise comparison. More...

UTextOffset indexOf (const UChar *srcChars, UTextOffset srcStart, int32_t srcLength, UTextOffset start, int32_t length) const
Locate in this the first occurrence in the range [start, start + length) of the characters in srcChars in the range [srcStart, srcStart + srcLength), using bitwise comparison. More...

UTextOffset indexOf (UChar c) const
Locate in this the first occurrence of the code point c, using bitwise comparison. More...

UTextOffset indexOf (UChar32 c) const
Locate in this the first occurrence of the code point c, using bitwise comparison. More...

UTextOffset indexOf (UChar c, UTextOffset start) const
Locate in this the first occurrence of the code point c starting at offset start, using bitwise comparison. More...

UTextOffset indexOf (UChar32 c, UTextOffset start) const
Locate in this the first occurrence of the code point c starting at offset start, using bitwise comparison. More...

UTextOffset indexOf (UChar c, UTextOffset start, int32_t length) const
Locate in this the first occurrence of the code point c in the range [start, start + length), using bitwise comparison. More...

UTextOffset indexOf (UChar32 c, UTextOffset start, int32_t length) const
Locate in this the first occurrence of the code point c in the range [start, start + length), using bitwise comparison. More...

UTextOffset lastIndexOf (const UnicodeString& text) const
Locate in this the last occurrence of the characters in text, using bitwise comparison. More...

UTextOffset lastIndexOf (const UnicodeString& text, UTextOffset start) const
Locate in this the last occurrence of the characters in text starting at offset start, using bitwise comparison. More...

UTextOffset lastIndexOf (const UnicodeString& text, UTextOffset start, int32_t length) const
Locate in this the last occurrence in the range [start, start + length) of the characters in text, using bitwise comparison. More...

UTextOffset lastIndexOf (const UnicodeString& srcText, UTextOffset srcStart, int32_t srcLength, UTextOffset start, int32_t length) const
Locate in this the last occurrence in the range [start, start + length) of the characters in srcText in the range [srcStart, srcStart + srcLength), using bitwise comparison. More...

UTextOffset lastIndexOf (const UChar *srcChars, int32_t srcLength, UTextOffset start) const
Locate in this the last occurrence of the characters in srcChars starting at offset start, using bitwise comparison. More...

UTextOffset lastIndexOf (const UChar *srcChars, int32_t srcLength, UTextOffset start, int32_t length) const
Locate in this the last occurrence in the range [start, start + length) of the characters in srcChars, using bitwise comparison. More...

UTextOffset lastIndexOf (const UChar *srcChars, UTextOffset srcStart, int32_t srcLength, UTextOffset start, int32_t length) const
Locate in this the last occurrence in the range [start, start + length) of the characters in srcChars in the range [srcStart, srcStart + srcLength), using bitwise comparison. More...

UTextOffset lastIndexOf (UChar c) const
Locate in this the last occurrence of the code point c, using bitwise comparison. More...

UTextOffset lastIndexOf (UChar32 c) const
Locate in this the last occurrence of the code point c, using bitwise comparison. More...

UTextOffset lastIndexOf (UChar c, UTextOffset start) const
Locate in this the last occurrence of the code point c starting at offset start, using bitwise comparison. More...

UTextOffset lastIndexOf (UChar32 c, UTextOffset start) const
Locate in this the last occurrence of the code point c starting at offset start, using bitwise comparison. More...

UTextOffset lastIndexOf (UChar c, UTextOffset start, int32_t length) const
Locate in this the last occurrence of the code point c in the range [start, start + length), using bitwise comparison. More...

UTextOffset lastIndexOf (UChar32 c, UTextOffset start, int32_t length) const
Locate in this the last occurrence of the code point c in the range [start, start + length), using bitwise comparison. More...

UChar charAt (UTextOffset offset) const
Return the code unit at offset offset. More...

UChar operator[] (UTextOffset offset) const
Return the code unit at offset offset. More...

UChar32 char32At (UTextOffset offset) const
Return the code point that contains the code unit at offset offset. More...

UTextOffset getCharStart (UTextOffset offset)
Adjust a random-access offset so that it points to the beginning of a Unicode character. More...

UTextOffset getCharLimit (UTextOffset offset)
Adjust a random-access offset so that it points behind a Unicode character. More...

void extract (UTextOffset start, int32_t length, UChar *dst, UTextOffset dstStart = 0) const
Copy the characters in the range [start, start + length) into the array dst, beginning at dstStart. More...

void extract (UTextOffset start, int32_t length, UnicodeString& target) const
Copy the characters in the range [start, start + length) into the UnicodeString target. More...

void extractBetween (UTextOffset start, UTextOffset limit, UChar *dst, UTextOffset dstStart = 0) const
Copy the characters in the range [start, limit) into the array dst, beginning at dstStart. More...

void extractBetween (UTextOffset start, UTextOffset limit, UnicodeString& target) const
Copy the characters in the range [start, limit) into the UnicodeString target. More...

int32_t extract (UTextOffset start, int32_t length, char *dst, const char *codepage = 0) const
Copy the characters in the range [start, start + length) into an array of characters in a specified codepage. More...

int32_t length (void) const
Return the length of the UnicodeString object. More...

UBool empty (void) const
Determine if this string is empty. More...

int32_t hashCode (void) const
Generate a hash code for this object. More...

UBool isBogus (void) const
Determine if this string is still valid. More...

UnicodeString& operator= (const UnicodeString& srcText)
Assignment operator. More...

UnicodeString& operator= (UChar ch)
Assignment operator. More...

UnicodeString& operator= (UChar32 ch)
Assignment operator. More...

UnicodeString& setTo (const UnicodeString& srcText, UTextOffset srcStart, int32_t srcLength)
Set the text in the UnicodeString object to the characters in srcText in the range [srcStart, srcStart + srcLength). More...

UnicodeString& setTo (const UnicodeString& srcText)
Set the text in the UnicodeString object to the characters in srcText. More...

UnicodeString& setTo (const UChar *srcChars, int32_t srcLength)
Set the characters in the UnicodeString object to the characters in srcChars. More...

UnicodeString& setTo (UChar srcChar)
Set the characters in the UnicodeString object to the code point srcChar. More...

UnicodeString& setTo (UChar32 srcChar)
Set the characters in the UnicodeString object to the code point srcChar. More...

UnicodeString& setTo (UBool isTerminated, const UChar *text, int32_t textLength)
Aliasing setTo() function, analogous to the readonly-aliasing UChar* constructor. More...

UnicodeString& setTo (UChar *buffer, int32_t buffLength, int32_t buffCapacity)
Aliasing setTo() function, analogous to the writeable-aliasing UChar* constructor. More...

UnicodeString& setCharAt (UTextOffset offset, UChar ch)
Set the character at the specified offset to the specified character. More...

UnicodeString& operator+= (UChar ch)
Append operator. More...

UnicodeString& operator+= (UChar32 ch)
Append operator. More...

UnicodeString& operator+= (const UnicodeString& srcText)
Append operator. More...

UnicodeString& append (const UnicodeString& srcText, UTextOffset srcStart, int32_t srcLength)
Append the characters in srcText in the range [srcStart, srcStart + srcLength) to the UnicodeString object at offset start. More...

UnicodeString& append (const UnicodeString& srcText)
Append the characters in srcText to the UnicodeString object at offset start. More...

UnicodeString& append (const UChar *srcChars, UTextOffset srcStart, int32_t srcLength)
Append the characters in srcChars in the range [srcStart, srcStart + srcLength) to the UnicodeString object at offset start. More...

UnicodeString& append (const UChar *srcChars, int32_t srcLength)
Append the characters in srcChars to the UnicodeString object at offset start. More...

UnicodeString& append (UChar srcChar)
Append the code point srcChar to the UnicodeString object. More...

UnicodeString& append (UChar32 srcChar)
Append the code point srcChar to the UnicodeString object. More...

UnicodeString& insert (UTextOffset start, const UnicodeString& srcText, UTextOffset srcStart, int32_t srcLength)
Insert the characters in srcText in the range [srcStart, srcStart + srcLength) into the UnicodeString object at offset start. More...

UnicodeString& insert (UTextOffset start, const UnicodeString& srcText)
Insert the characters in srcText into the UnicodeString object at offset start. More...

UnicodeString& insert (UTextOffset start, const UChar *srcChars, UTextOffset srcStart, int32_t srcLength)
Insert the characters in srcChars in the range [srcStart, srcStart + srcLength) into the UnicodeString object at offset start. More...

UnicodeString& insert (UTextOffset start, const UChar *srcChars, int32_t srcLength)
Insert the characters in srcChars into the UnicodeString object at offset start. More...

UnicodeString& insert (UTextOffset start, UChar srcChar)
Insert the code point srcChar into the UnicodeString object at offset start. More...

UnicodeString& insert (UTextOffset start, UChar32 srcChar)
Insert the code point srcChar into the UnicodeString object at offset start. More...

UnicodeString& replace (UTextOffset start, int32_t length, const UnicodeString& srcText, UTextOffset srcStart, int32_t srcLength)
Replace the characters in the range [start, start + length) with the characters in srcText in the range [srcStart, srcStart + srcLength). More...

UnicodeString& replace (UTextOffset start, int32_t length, const UnicodeString& srcText)
Replace the characters in the range [start, start + length) with the characters in srcText. More...

UnicodeString& replace (UTextOffset start, int32_t length, const UChar *srcChars, UTextOffset srcStart, int32_t srcLength)
Replace the characters in the range [start, start + length) with the characters in srcChars in the range [srcStart, srcStart + srcLength). More...

UnicodeString& replace (UTextOffset start, int32_t length, const UChar *srcChars, int32_t srcLength)
Replace the characters in the range [start, start + length) with the characters in srcChars. More...

UnicodeString& replace (UTextOffset start, int32_t length, UChar srcChar)
Replace the characters in the range [start, start + length) with the characters in srcText. More...

UnicodeString& replace (UTextOffset start, int32_t length, UChar32 srcChar)
Replace the characters in the range [start, start + length) with the code point srcChar. More...

UnicodeString& replaceBetween (UTextOffset start, UTextOffset limit, const UnicodeString& srcText)
Replace the characters in the range [start, limit) with the characters in srcText. More...

UnicodeString& replaceBetween (UTextOffset start, UTextOffset limit, const UnicodeString& srcText, UTextOffset srcStart, UTextOffset srcLimit)
Replace the characters in the range [start, limit) with the characters in srcText in the range [srcStart, srcLimit). More...

virtual void handleReplaceBetween (UTextOffset start, UTextOffset limit, const UnicodeString& text)
Replace a substring of this object with the given text. More...

virtual void copy (int32_t start, int32_t limit, int32_t dest)
Copy a substring of this object, retaining attribute (out-of-band) information. More...

UnicodeString& findAndReplace (const UnicodeString& oldText, const UnicodeString& newText)
Replace all occurrences of characters in oldText with the characters in newText. More...

UnicodeString& findAndReplace (UTextOffset start, int32_t length, const UnicodeString& oldText, const UnicodeString& newText)
Replace all occurrences of characters in oldText with characters in newText in the range [start, start + length). More...

UnicodeString& findAndReplace (UTextOffset start, int32_t length, const UnicodeString& oldText, UTextOffset oldStart, int32_t oldLength, const UnicodeString& newText, UTextOffset newStart, int32_t newLength)
Replace all occurrences of characters in oldText in the range [oldStart, oldStart + oldLength) with the characters in newText in the range [newStart, newStart + newLength) in the range [start, start + length). More...

UnicodeString& remove (void)
Remove all characters from the UnicodeString object. More...

UnicodeString& remove (UTextOffset start, int32_t length = INT32_MAX)
Remove the characters in the range [start, start + length) from the UnicodeString object. More...

UnicodeString& removeBetween (UTextOffset start, UTextOffset limit = INT32_MAX)
Remove the characters in the range [start, limit) from the UnicodeString object. More...

UBool padLeading (int32_t targetLength, UChar padChar = 0x0020)
Pad the start of this UnicodeString with the character padChar. More...

UBool padTrailing (int32_t targetLength, UChar padChar = 0x0020)
Pad the end of this UnicodeString with the character padChar. More...

UBool truncate (int32_t targetLength)
Truncate this UnicodeString to the targetLength. More...

UnicodeString& trim (void)
Trims leading and trailing whitespace from this UnicodeString. More...

UnicodeString& reverse (void)
Reverse this UnicodeString in place. More...

UnicodeString& reverse (UTextOffset start, int32_t length)
Reverse the range [start, start + length) in this UnicodeString. More...

UnicodeString& toUpper (void)
Convert the characters in this to UPPER CASE following the conventions of the default locale. More...

UnicodeString& toUpper (const Locale& locale)
Convert the characters in this to UPPER CASE following the conventions of a specific locale. More...

UnicodeString& toLower (void)
Convert the characters in this to UPPER CASE following the conventions of the default. More...

UnicodeString& toLower (const Locale& locale)
Convert the characters in this to UPPER CASE following the conventions of a specific locale. More...

 UnicodeString ()
Construct an empty UnicodeString. More...

 UnicodeString (int32_t capacity, UChar32 c, int32_t count)
Construct a UnicodeString with capacity to hold capacity UChars. More...

 UnicodeString (UChar ch)
Single UChar32 (code point) constructor. More...

 UnicodeString (UChar32 ch)
Single UChar32 (code point) constructor. More...

 UnicodeString (const UChar *text)
UChar* constructor. More...

 UnicodeString (const UChar *text, int32_t textLength)
UChar* constructor. More...

 UnicodeString (UBool isTerminated, const UChar *text, int32_t textLength)
Readonly-aliasing UChar* constructor. More...

 UnicodeString (UChar *buffer, int32_t buffLength, int32_t buffCapacity)
Writeable-aliasing UChar* constructor. More...

 UnicodeString (const char *codepageData, const char *codepage = 0)
char* constructor. More...

 UnicodeString (const char *codepageData, int32_t dataLength, const char *codepage = 0)
char* constructor. More...

 UnicodeString (const UnicodeString& that)
Copy constructor. More...

 ~UnicodeString ()
Destructor. More...

int32_t numDisplayCells (UTextOffset start = 0, int32_t length = INT32_MAX, UBool asian = TRUE) const
Returns the number of display cells occupied by the range [start, length). More...

UCharReference operator[] (UTextOffset pos)
int32_t size (void) const
UnicodeString& findAndReplace (const UnicodeString& oldText, const UnicodeString& newText, UTextOffset start, int32_t length)
void* operator new (size_t size)
void* operator new (size_t size, void *location)
void operator delete (void *location)
const UChargetUChars () const

Friends

class  UnicodeStringStreamer
class  UnicodeConverterCPP
class  StringCharacterIterator

Detailed Description

UnicodeString is a concrete implementation of the abstract class Replaceable.

It is a string class that stores Unicode characters directly and provides similar functionality as the Java string class.

UnicodeString uses four storage models:

  1. Short strings are normally stored inside the UnicodeString object itself. The object has fields for the "bookkeeping" and a small UChar array. When the object is copied, then the internal characters are copied into the destination object.
  2. Longer strings are normally stored in allocated memory. The allocated UChar array is preceeded by a reference counter. When the string object is copied, then the allocated buffer is shared by incrementing the reference counter.
  3. A UnicodeString can be constructed or setTo() such that it aliases a read-only buffer instead of copying the characters. In this case, the string object uses this aliased buffer for as long as it is not modified, and it will never attempt to modify or release the buffer. This has copy-on-write semantics: When the string object is modified, then the buffer contents is first copied into writeable memory (inside the object for short strings, or allocated buffer for longer strings). When a UnicodeString with a read-only alias is assigned to another UnicodeString, then both string objects will share the same read-only alias.
  4. A UnicodeString can be constructed or setTo() such that it aliases a writeable buffer instead of copying the characters. The difference from the above is that the string object will write through to this aliased buffer for write operations. Only when the capacity of the buffer is not sufficient is a new buffer allocated and the contents copied. An efficient way to get the string contents into the original buffer is to use the extract(..., UChar *dst, ...) function: It will only copy the string contents if the dst buffer is different from the buffer of the string object itself. If a string grows and shrinks during a sequence of operations, then it will not use the same buffer any more, but may fit into it again. When a UnicodeString with a writeable alias is assigned to another UnicodeString, then the contents is always copied. The destination string will not alias to the buffer that the source string aliases.

Definition at line 113 of file unistr.h.


Member Function Documentation

UBool UnicodeString::operator== (const UnicodeString & text) const [inline]

Equality operator.

Performs only bitwise comparison.

Parameters:
text   The UnicodeString to compare to this one.
Returns:
TRUE if text contains the same characters as this one, FALSE otherwise.
Stable:

Definition at line 2054 of file unistr.h.

UBool UnicodeString::operator!= (const UnicodeString & text) const [inline]

Inequality operator.

Performs only bitwise comparison.

Parameters:
text   The UnicodeString to compare to this one.
Returns:
FALSE if text contains the same characters as this one, TRUE otherwise.
Stable:

Definition at line 2067 of file unistr.h.

UBool UnicodeString::operator> (const UnicodeString & text) const [inline]

Greater than operator.

Performs only bitwise comparison.

Parameters:
text   The UnicodeString to compare to this one.
Returns:
TRUE if the characters in text are bitwise greater than the characters in this, FALSE otherwise
Stable:

Definition at line 2071 of file unistr.h.

UBool UnicodeString::operator< (const UnicodeString & text) const [inline]

Less than operator.

Performs only bitwise comparison.

Parameters:
text   The UnicodeString to compare to this one.
Returns:
TRUE if the characters in text are bitwise less than the characters in this, FALSE otherwise
Stable:

Definition at line 2075 of file unistr.h.

UBool UnicodeString::operator>= (const UnicodeString & text) const [inline]

Greater than or equal operator.

Performs only bitwise comparison.

Parameters:
text   The UnicodeString to compare to this one.
Returns:
TRUE if the characters in text are bitwise greater than or equal to the characters in this, FALSE otherwise
Stable:

Definition at line 2079 of file unistr.h.

UBool UnicodeString::operator<= (const UnicodeString & text) const [inline]

Less than or equal operator.

Performs only bitwise comparison.

Parameters:
text   The UnicodeString to compare to this one.
Returns:
TRUE if the characters in text are bitwise less than or equal to the characters in this, FALSE otherwise
Stable:

Definition at line 2083 of file unistr.h.

int8_t UnicodeString::compare (const UnicodeString & text) const [inline]

Compare the characters bitwise in this UnicodeString to the characters in text.

Parameters:
text   The UnicodeString to compare to this one.
Returns:
The result of bitwise character comparison: 0 if text contains the same characters as this, -1 if the characters in text are bitwise less than the characters in this, +1 if the characters in text are bitwise greater than the characters in this.
Stable:

Definition at line 2087 of file unistr.h.

int8_t UnicodeString::compare (UTextOffset start, int32_t length, const UnicodeString & srcText) const [inline]

Compare the characters bitwise in the range [start, start + length) with the characters in srcText.

Parameters:
start   the offset at which the compare operation begins
length   the number of characters of text to compare.
srcText   the text to be compared
Returns:
The result of bitwise character comparison: 0 if text contains the same characters as this, -1 if the characters in text are bitwise less than the characters in this, +1 if the characters in text are bitwise greater than the characters in this.
Stable:

Definition at line 2091 of file unistr.h.

int8_t UnicodeString::compare (UTextOffset start, int32_t length, const UnicodeString & srcText, UTextOffset srcStart, int32_t srcLength) const [inline]

Compare the characters bitwise in the range [start, start + length) with the characters in srcText in the range [srcStart, srcStart + srcLength).

Parameters:
start   the offset at which the compare operation begins
length   the number of characters in this to compare.
srcText   the text to be compared
srcStart   the offset into srcText to start comparison
srcLength   the number of characters in src to compare
Returns:
The result of bitwise character comparison: 0 if text contains the same characters as this, -1 if the characters in text are bitwise less than the characters in this, +1 if the characters in text are bitwise greater than the characters in this.
Stable:

Definition at line 2102 of file unistr.h.

int8_t UnicodeString::compare (const UChar * srcChars, int32_t srcLength) const [inline]

Compare the characters bitwise in this UnicodeString with the first srcLength characters in srcChars.

Parameters:
srcChars   The characters to compare to this UnicodeString.
srcLength   the number of characters in srcChars to compare
Returns:
The result of bitwise character comparison: 0 if text contains the same characters as this, -1 if the characters in text are bitwise less than the characters in this, +1 if the characters in text are bitwise greater than the characters in this.
Stable:

Definition at line 2097 of file unistr.h.

int8_t UnicodeString::compare (UTextOffset start, int32_t length, const UChar * srcChars) const [inline]

Compare the characters bitwise in the range [start, start + length) with the first length characters in srcChars.

Parameters:
start   the offset at which the compare operation begins
length   the number of characters to compare.
srcChars   the characters to be compared
Returns:
The result of bitwise character comparison: 0 if text contains the same characters as this, -1 if the characters in text are bitwise less than the characters in this, +1 if the characters in text are bitwise greater than the characters in this.
Stable:

Definition at line 2091 of file unistr.h.

int8_t UnicodeString::compare (UTextOffset start, int32_t length, const UChar * srcChars, UTextOffset srcStart, int32_t srcLength) const [inline]

Compare the characters bitwise in the range [start, start + length) with the characters in srcChars in the range [srcStart, srcStart + srcLength).

Parameters:
start   the offset at which the compare operation begins
length   the number of characters in this to compare
srcChars   the characters to be compared
srcStart   the offset into srcChars to start comparison
srcLength   the number of characters in srcChars to compare
Returns:
The result of bitwise character comparison: 0 if text contains the same characters as this, -1 if the characters in text are bitwise less than the characters in this, +1 if the characters in text are bitwise greater than the characters in this.
Stable:

Definition at line 2102 of file unistr.h.

int8_t UnicodeString::compareBetween (UTextOffset start, UTextOffset limit, const UnicodeString & srcText, UTextOffset srcStart, UTextOffset srcLimit) const [inline]

Compare the characters bitwise in the range [start, limit) with the characters in srcText in the range [srcStart, srcLimit).

Parameters:
start   the offset at which the compare operation begins
limit   the offset immediately following the compare operation
srcText   the text to be compared
srcStart   the offset into srcText to start comparison
srcLimit   the offset into srcText to limit comparison
Returns:
The result of bitwise character comparison: 0 if text contains the same characters as this, -1 if the characters in text are bitwise less than the characters in this, +1 if the characters in text are bitwise greater than the characters in this.
Stable:

Definition at line 2124 of file unistr.h.

UBool UnicodeString::startsWith (const UnicodeString & text) const [inline]

Determine if this starts with the characters in text.

Parameters:
text   The text to match.
Returns:
TRUE if this starts with the characters in text, FALSE otherwise
Stable:

Definition at line 2346 of file unistr.h.

UBool UnicodeString::startsWith (const UnicodeString & srcText, UTextOffset srcStart, int32_t srcLength) const [inline]

Determine if this starts with the characters in srcText in the range [srcStart, srcStart + srcLength).

Parameters:
srcText   The text to match.
srcStart   the offset into srcText to start matching
srcLength   the number of characters in srcText to match
Returns:
TRUE if this starts with the characters in text, FALSE otherwise
Stable:

Definition at line 2350 of file unistr.h.

UBool UnicodeString::startsWith (const UChar * srcChars, int32_t srcLength) const [inline]

Determine if this starts with the characters in srcChars.

Parameters:
srcChars   The characters to match.
srcLength   the number of characters in srcChars
Returns:
TRUE if this starts with the characters in srcChars, FALSE otherwise
Stable:

Definition at line 2356 of file unistr.h.

UBool UnicodeString::startsWith (const UChar * srcChars, UTextOffset srcStart, int32_t srcLength) const [inline]

Determine if this ends with the characters in srcChars in the range [srcStart, srcStart + srcLength).

Parameters:
srcChars   The characters to match.
srcStart   the offset into srcText to start matching
srcLength   the number of characters in srcChars to match
Returns:
TRUE if this ends with the characters in srcChars, FALSE otherwise
Stable:

Definition at line 2361 of file unistr.h.

UBool UnicodeString::endsWith (const UnicodeString & text) const [inline]

Determine if this ends with the characters in text.

Parameters:
text   The text to match.
Returns:
TRUE if this ends with the characters in text, FALSE otherwise
Stable:

Definition at line 2367 of file unistr.h.

UBool UnicodeString::endsWith (const UnicodeString & srcText, UTextOffset srcStart, int32_t srcLength) const [inline]

Determine if this ends with the characters in srcText in the range [srcStart, srcStart + srcLength).

Parameters:
srcText   The text to match.
srcStart   the offset into srcText to start matching
srcLength   the number of characters in srcText to match
Returns:
TRUE if this ends with the characters in text, FALSE otherwise
Stable:

Definition at line 2372 of file unistr.h.

UBool UnicodeString::endsWith (const UChar * srcChars, int32_t srcLength) const [inline]

Determine if this ends with the characters in srcChars.

Parameters:
srcChars   The characters to match.
srcLength   the number of characters in srcChars
Returns:
TRUE if this ends with the characters in srcChars, FALSE otherwise
Stable:

Definition at line 2379 of file unistr.h.

UBool UnicodeString::endsWith (const UChar * srcChars, UTextOffset srcStart, int32_t srcLength) const [inline]

Determine if this ends with the characters in srcChars in the range [srcStart, srcStart + srcLength).

Parameters:
srcChars   The characters to match.
srcStart   the offset into srcText to start matching
srcLength   the number of characters in srcChars to match
Returns:
TRUE if this ends with the characters in srcChars, FALSE otherwise
Stable:

Definition at line 2385 of file unistr.h.

UTextOffset UnicodeString::indexOf (const UnicodeString & text) const [inline]

Locate in this the first occurrence of the characters in text, using bitwise comparison.

Parameters:
text   The text to search for.
Returns:
The offset into this of the start of text, or -1 if not found.
Stable:

Definition at line 2150 of file unistr.h.

UTextOffset UnicodeString::indexOf (const UnicodeString & text, UTextOffset start) const [inline]

Locate in this the first occurrence of the characters in text starting at offset start, using bitwise comparison.

Parameters:
text   The text to search for.
start   The offset at which searching will start.
Returns:
The offset into this of the start of text, or -1 if not found.
Stable:

Definition at line 2154 of file unistr.h.

UTextOffset UnicodeString::indexOf (const UnicodeString & text, UTextOffset start, int32_t length) const [inline]

Locate in this the first occurrence in the range [start, start + length) of the characters in text, using bitwise comparison.

Parameters:
text   The text to search for.
start   The offset at which searching will start.
length   The number of characters to search
Returns:
The offset into this of the start of text, or -1 if not found.
Stable:

Definition at line 2159 of file unistr.h.

UTextOffset UnicodeString::indexOf (const UnicodeString & srcText, UTextOffset srcStart, int32_t srcLength, UTextOffset start, int32_t length) const [inline]

Locate in this the first occurrence in the range [start, start + length) of the characters in srcText in the range [srcStart, srcStart + srcLength), using bitwise comparison.

Parameters:
text   The text to search for.
srcStart   the offset into srcText at which to start matching
srcLength   the number of characters in srcText to match
start   the offset into this at which to start matching
length   the number of characters in this to search
Returns:
The offset into this of the start of text, or -1 if not found.
Stable:

Definition at line 2165 of file unistr.h.

UTextOffset UnicodeString::indexOf (const UChar * srcChars, int32_t srcLength, UTextOffset start) const [inline]

Locate in this the first occurrence of the characters in srcChars starting at offset start, using bitwise comparison.

Parameters:
srcChars   The text to search for.
srcLength   the number of characters in srcChars to match
start   the offset into this at which to start matching
Returns:
The offset into this of the start of text, or -1 if not found.
Stable:

Definition at line 2181 of file unistr.h.

UTextOffset UnicodeString::indexOf (const UChar * srcChars, int32_t srcLength, UTextOffset start, int32_t length) const [inline]

Locate in this the first occurrence in the range [start, start + length) of the characters in srcChars, using bitwise comparison.

Parameters:
text   The text to search for.
srcLength   the number of characters in srcChars
start   The offset at which searching will start.
length   The number of characters to search
Returns:
The offset into this of the start of srcChars, or -1 if not found.
Stable:

Definition at line 2187 of file unistr.h.

UTextOffset UnicodeString::indexOf (const UChar * srcChars, UTextOffset srcStart, int32_t srcLength, UTextOffset start, int32_t length) const

Locate in this the first occurrence in the range [start, start + length) of the characters in srcChars in the range [srcStart, srcStart + srcLength), using bitwise comparison.

Parameters:
srcChars   The text to search for.
srcStart   the offset into srcChars at which to start matching
srcLength   the number of characters in srcChars to match
start   the offset into this at which to start matching
length   the number of characters in this to search
Returns:
The offset into this of the start of text, or -1 if not found.
Stable:

UTextOffset UnicodeString::indexOf (UChar c) const [inline]

Locate in this the first occurrence of the code point c, using bitwise comparison.

Parameters:
c   The code unit to search for.
Returns:
The offset into this of c, or -1 if not found.
Draft:

Definition at line 2194 of file unistr.h.

UTextOffset UnicodeString::indexOf (UChar32 c) const [inline]

Locate in this the first occurrence of the code point c, using bitwise comparison.

Parameters:
c   The code point to search for.
Returns:
The offset into this of c, or -1 if not found.
Draft:

Definition at line 2198 of file unistr.h.

UTextOffset UnicodeString::indexOf (UChar c, UTextOffset start) const [inline]

Locate in this the first occurrence of the code point c starting at offset start, using bitwise comparison.

Parameters:
c   The code unit to search for.
start   The offset at which searching will start.
Returns:
The offset into this of c, or -1 if not found.
Draft:

Definition at line 2210 of file unistr.h.

UTextOffset UnicodeString::indexOf (UChar32 c, UTextOffset start) const [inline]

Locate in this the first occurrence of the code point c starting at offset start, using bitwise comparison.

Parameters:
c   The code point to search for.
start   The offset at which searching will start.
Returns:
The offset into this of c, or -1 if not found.
Draft:

Definition at line 2215 of file unistr.h.

UTextOffset UnicodeString::indexOf (UChar c, UTextOffset start, int32_t length) const [inline]

Locate in this the first occurrence of the code point c in the range [start, start + length), using bitwise comparison.

Parameters:
c   The code unit to search for.
start   the offset into this at which to start matching
length   the number of characters in this to search
Returns:
The offset into this of c, or -1 if not found.
Draft:

Definition at line 2228 of file unistr.h.

UTextOffset UnicodeString::indexOf (UChar32 c, UTextOffset start, int32_t length) const [inline]

Locate in this the first occurrence of the code point c in the range [start, start + length), using bitwise comparison.

Parameters:
c   The code point to search for.
start   the offset into this at which to start matching
length   the number of characters in this to search
Returns:
The offset into this of c, or -1 if not found.
Draft:

Definition at line 2234 of file unistr.h.

UTextOffset UnicodeString::lastIndexOf (const UnicodeString & text) const [inline]

Locate in this the last occurrence of the characters in text, using bitwise comparison.

Parameters:
text   The text to search for.
Returns:
The offset into this of the start of text, or -1 if not found.
Stable:

Definition at line 2248 of file unistr.h.

UTextOffset UnicodeString::lastIndexOf (const UnicodeString & text, UTextOffset start) const [inline]

Locate in this the last occurrence of the characters in text starting at offset start, using bitwise comparison.

Parameters:
text   The text to search for.
start   The offset at which searching will start.
Returns:
The offset into this of the start of text, or -1 if not found.
Stable:

Definition at line 2252 of file unistr.h.

UTextOffset UnicodeString::lastIndexOf (const UnicodeString & text, UTextOffset start, int32_t length) const [inline]

Locate in this the last occurrence in the range [start, start + length) of the characters in text, using bitwise comparison.

Parameters:
text   The text to search for.
start   The offset at which searching will start.
length   The number of characters to search
Returns:
The offset into this of the start of text, or -1 if not found.
Stable:

Definition at line 2257 of file unistr.h.

UTextOffset UnicodeString::lastIndexOf (const UnicodeString & srcText, UTextOffset srcStart, int32_t srcLength, UTextOffset start, int32_t length) const [inline]

Locate in this the last occurrence in the range [start, start + length) of the characters in srcText in the range [srcStart, srcStart + srcLength), using bitwise comparison.

Parameters:
text   The text to search for.
srcStart   the offset into srcText at which to start matching
srcLength   the number of characters in srcText to match
start   the offset into this at which to start matching
length   the number of characters in this to search
Returns:
The offset into this of the start of text, or -1 if not found.
Stable:

Definition at line 2263 of file unistr.h.

UTextOffset UnicodeString::lastIndexOf (const UChar * srcChars, int32_t srcLength, UTextOffset start) const [inline]

Locate in this the last occurrence of the characters in srcChars starting at offset start, using bitwise comparison.

Parameters:
srcChars   The text to search for.
srcLength   the number of characters in srcChars to match
start   the offset into this at which to start matching
Returns:
The offset into this of the start of text, or -1 if not found.
Stable:

Definition at line 2279 of file unistr.h.

UTextOffset UnicodeString::lastIndexOf (const UChar * srcChars, int32_t srcLength, UTextOffset start, int32_t length) const [inline]

Locate in this the last occurrence in the range [start, start + length) of the characters in srcChars, using bitwise comparison.

Parameters:
text   The text to search for.
srcLength   the number of characters in srcChars
start   The offset at which searching will start.
length   The number of characters to search
Returns:
The offset into this of the start of srcChars, or -1 if not found.
Stable:

Definition at line 2285 of file unistr.h.

UTextOffset UnicodeString::lastIndexOf (const UChar * srcChars, UTextOffset srcStart, int32_t srcLength, UTextOffset start, int32_t length) const

Locate in this the last occurrence in the range [start, start + length) of the characters in srcChars in the range [srcStart, srcStart + srcLength), using bitwise comparison.

Parameters:
srcChars   The text to search for.
srcStart   the offset into srcChars at which to start matching
srcLength   the number of characters in srcChars to match
start   the offset into this at which to start matching
length   the number of characters in this to search
Returns:
The offset into this of the start of text, or -1 if not found.
Stable:

UTextOffset UnicodeString::lastIndexOf (UChar c) const [inline]

Locate in this the last occurrence of the code point c, using bitwise comparison.

Parameters:
c   The code unit to search for.
Returns:
The offset into this of c, or -1 if not found.
Draft:

Definition at line 2292 of file unistr.h.

UTextOffset UnicodeString::lastIndexOf (UChar32 c) const [inline]

Locate in this the last occurrence of the code point c, using bitwise comparison.

Parameters:
c   The code point to search for.
Returns:
The offset into this of c, or -1 if not found.
Draft:

Definition at line 2296 of file unistr.h.

UTextOffset UnicodeString::lastIndexOf (UChar c, UTextOffset start) const [inline]

Locate in this the last occurrence of the code point c starting at offset start, using bitwise comparison.

Parameters:
c   The code unit to search for.
start   The offset at which searching will start.
Returns:
The offset into this of c, or -1 if not found.
Draft:

Definition at line 2308 of file unistr.h.

UTextOffset UnicodeString::lastIndexOf (UChar32 c, UTextOffset start) const [inline]

Locate in this the last occurrence of the code point c starting at offset start, using bitwise comparison.

Parameters:
c   The code point to search for.
start   The offset at which searching will start.
Returns:
The offset into this of c, or -1 if not found.
Draft:

Definition at line 2313 of file unistr.h.

UTextOffset UnicodeString::lastIndexOf (UChar c, UTextOffset start, int32_t length) const [inline]

Locate in this the last occurrence of the code point c in the range [start, start + length), using bitwise comparison.

Parameters:
c   The code unit to search for.
start   the offset into this at which to start matching
length   the number of characters in this to search
Returns:
The offset into this of c, or -1 if not found.
Draft:

Definition at line 2326 of file unistr.h.

UTextOffset UnicodeString::lastIndexOf (UChar32 c, UTextOffset start, int32_t length) const [inline]

Locate in this the last occurrence of the code point c in the range [start, start + length), using bitwise comparison.

Parameters:
c   The code point to search for.
start   the offset into this at which to start matching
length   the number of characters in this to search
Returns:
The offset into this of c, or -1 if not found.
Draft:

Definition at line 2332 of file unistr.h.

UChar UnicodeString::charAt (UTextOffset offset) const [inline, virtual]

Return the code unit at offset offset.

Parameters:
offset   a valid offset into the text
Returns:
the code unit at offset offset
Draft:

Reimplemented from Replaceable.

Definition at line 2512 of file unistr.h.

UChar UnicodeString::operator[] (UTextOffset offset) const [inline]

Return the code unit at offset offset.

Parameters:
offset   a valid offset into the text
Returns:
the code unit at offset offset
Draft:

Definition at line 2516 of file unistr.h.

UChar32 UnicodeString::char32At (UTextOffset offset) const [inline, virtual]

Return the code point that contains the code unit at offset offset.

Parameters:
offset   a valid offset into the text that indicates the text offset of any of the code units that will be assembled into a code point (21-bit value) and returned
Returns:
the code point of text at offset
Draft:

Reimplemented from Replaceable.

Definition at line 2520 of file unistr.h.

UTextOffset UnicodeString::getCharStart (UTextOffset offset) [inline]

Adjust a random-access offset so that it points to the beginning of a Unicode character.

The offset that is passed in points to any code unit of a code point, while the returned offset will point to the first code unit of the same code point. In UTF-16, if the input offset points to a second surrogate of a surrogate pair, then the returned offset will point to the first surrogate.

Parameters:
offset   a valid offset into one code point of the text
Returns:
offset of the first code unit of the same code point

Definition at line 2532 of file unistr.h.

UTextOffset UnicodeString::getCharLimit (UTextOffset offset) [inline]

Adjust a random-access offset so that it points behind a Unicode character.

The offset that is passed in points behind any code unit of a code point, while the returned offset will point behind the last code unit of the same code point. In UTF-16, if the input offset points behind the first surrogate (i.e., to the second surrogate) of a surrogate pair, then the returned offset will point behind the second surrogate (i.e., to the first surrogate).

Parameters:
offset   a valid offset after any code unit of a code point of the text
Returns:
offset of the first code unit after the same code point

Definition at line 2542 of file unistr.h.

void UnicodeString::extract (UTextOffset start, int32_t length, UChar * dst, UTextOffset dstStart = 0) const [inline]

Copy the characters in the range [start, start + length) into the array dst, beginning at dstStart.

If the string aliases to dst itself as an external buffer, then extract() will not copy the contents.

Parameters:
start   offset of first character which will be copied into the array
length   the number of characters to extract
dst   array in which to copy characters. The length of dst must be at least (dstStart + length).
dstStart   the offset in dst where the first character will be extracted
Stable:

void UnicodeString::extract (UTextOffset start, int32_t length, UnicodeString & target) const [inline]

Copy the characters in the range [start, start + length) into the UnicodeString target.

Parameters:
start   offset of first character which will be copied
length   the number of characters to extract
target   UnicodeString into which to copy characters.
Returns:
A reference to target
Stable:

Definition at line 2483 of file unistr.h.

void UnicodeString::extractBetween (UTextOffset start, UTextOffset limit, UChar * dst, UTextOffset dstStart = 0) const [inline, virtual]

Copy the characters in the range [start, limit) into the array dst, beginning at dstStart.

Parameters:
start   offset of first character which will be copied into the array
limit   offset immediately following the last character to be copied
dst   array in which to copy characters. The length of dst must be at least (dstStart + (limit - start)).
dstStart   the offset in dst where the first character will be extracted
Stable:

Reimplemented from Replaceable.

Definition at line 2489 of file unistr.h.

void UnicodeString::extractBetween (UTextOffset start, UTextOffset limit, UnicodeString & target) const [inline]

Copy the characters in the range [start, limit) into the UnicodeString target.

Parameters:
start   offset of first character which will be copied
limit   offset immediately following the last character to be copied
target   UnicodeString into which to copy characters.
Returns:
A reference to target
Stable:

Definition at line 2496 of file unistr.h.

void UnicodeString::extract (UTextOffset start, int32_t length, char * dst, const char * codepage = 0) const [inline]

Copy the characters in the range [start, start + length) into an array of characters in a specified codepage.

Parameters:
start   offset of first character which will be copied
length   the number of characters to extract
target   the target buffer for extraction
codepage   the desired codepage for the characters. 0 has the special meaning of the default codepage If codepage is an empty string (""), then a simple conversion is performed on the codepage-invariant subset ("invariant characters") of the platform encoding. See utypes.h.
Returns:
the number of characters written to dst
Stable:

Definition at line 2476 of file unistr.h.

int32_t UnicodeString::length (void) const [inline, virtual]

Return the length of the UnicodeString object.

The length is the number of characters in the text.

Returns:
the length of the UnicodeString object
Stable:

Reimplemented from Replaceable.

Definition at line 2559 of file unistr.h.

UBool UnicodeString::empty (void) const [inline]

Determine if this string is empty.

Returns:
TRUE if this string contains 0 characters, FALSE otherwise.
Stable:

Definition at line 2552 of file unistr.h.

int32_t UnicodeString::hashCode (void) const [inline]

Generate a hash code for this object.

Returns:
The hash code of this UnicodeString.
Stable:

Definition at line 2563 of file unistr.h.

UBool UnicodeString::isBogus (void) const [inline]

Determine if this string is still valid.

Returns:
TRUE if the string is valid, FALSE otherwise
Draft:

Definition at line 2724 of file unistr.h.

UnicodeString & UnicodeString::operator= (const UnicodeString & srcText)

Assignment operator.

Replace the characters in this UnicodeString with the characters from srcText.

Parameters:
srcText   The text containing the characters to replace
Returns:
a reference to this
Stable:

UnicodeString & UnicodeString::operator= (UChar ch) [inline]

Assignment operator.

Replace the characters in this UnicodeString with the code unit ch.

Parameters:
ch   the code unit to replace
Returns:
a reference to this
Draft:

Definition at line 2570 of file unistr.h.

UnicodeString & UnicodeString::operator= (UChar32 ch) [inline]

Assignment operator.

Replace the characters in this UnicodeString with the code point ch.

Parameters:
ch   the code point to replace
Returns:
a reference to this
Draft:

Definition at line 2574 of file unistr.h.

UnicodeString & UnicodeString::setTo (const UnicodeString & srcText, UTextOffset srcStart, int32_t srcLength) [inline]

Set the text in the UnicodeString object to the characters in srcText in the range [srcStart, srcStart + srcLength).

srcText is not modified.

Parameters:
srcText   the source for the new characters
srcStart   the offset into srcText where new characters will be obtained
srcLength   the number of characters in srcText in the replace string.
Returns:
a reference to this
Stable:

Definition at line 2578 of file unistr.h.

UnicodeString & UnicodeString::setTo (const UnicodeString & srcText) [inline]

Set the text in the UnicodeString object to the characters in srcText.

srcText is not modified.

Parameters:
srcText   the source for the new characters
Returns:
a reference to this
Stable:

Definition at line 2584 of file unistr.h.

UnicodeString & UnicodeString::setTo (const UChar * srcChars, int32_t srcLength) [inline]

Set the characters in the UnicodeString object to the characters in srcChars.

srcChars is not modified.

Parameters:
srcChars   the source for the new characters
srcLength   the number of Unicode characters in srcChars.
Returns:
a reference to this
Stable:

Definition at line 2588 of file unistr.h.

UnicodeString & UnicodeString::setTo (UChar srcChar) [inline]

Set the characters in the UnicodeString object to the code point srcChar.

Parameters:
srcChar   the code unit which becomes the UnicodeString's character content
Returns:
a reference to this
Draft:

Definition at line 2593 of file unistr.h.

UnicodeString & UnicodeString::setTo (UChar32 srcChar) [inline]

Set the characters in the UnicodeString object to the code point srcChar.

Parameters:
srcChar   the code point which becomes the UnicodeString's character content
Returns:
a reference to this
Draft:

Definition at line 2597 of file unistr.h.

UnicodeString & UnicodeString::setTo (UBool isTerminated, const UChar * text, int32_t textLength)

Aliasing setTo() function, analogous to the readonly-aliasing UChar* constructor.

The text will be used for the UnicodeString object, but it will not be released when the UnicodeString is destroyed. This has copy-on-write semantics: When the string is modified, then the buffer is first copied into newly allocated memory. The aliased buffer is never modified. In an assignment to another UnicodeString, the text will be aliased again, so that both strings then alias the same readonly-text.

Parameters:
isTerminated   specifies if text is NUL-terminated. This must be true if textLength==-1.
text   The characters to alias for the UnicodeString.
textLength   The number of Unicode characters in text to alias. If -1, then this constructor will determine the length by calling u_strlen().
Draft:

UnicodeString & UnicodeString::setTo (UChar * buffer, int32_t buffLength, int32_t buffCapacity)

Aliasing setTo() function, analogous to the writeable-aliasing UChar* constructor.

The text will be used for the UnicodeString object, but it will not be released when the UnicodeString is destroyed. This has write-through semantics: For as long as the capacity of the buffer is sufficient, write operations will directly affect the buffer. When more capacity is necessary, then a new buffer will be allocated and the contents copied as with regularly constructed strings. In an assignment to another UnicodeString, the buffer will be copied. The extract(UChar *dst) function detects whether the dst pointer is the same as the string buffer itself and will in this case not copy the contents.

Parameters:
buffer   The characters to alias for the UnicodeString.
buffLength   The number of Unicode characters in buffer to alias.
buffCapacity   The size of buffer in UChars.
Draft:

UnicodeString & UnicodeString::setCharAt (UTextOffset offset, UChar ch)

Set the character at the specified offset to the specified character.

Parameters:
offset   A valid offset into the text of the character to set
ch   The new character
Returns:
A reference to this
Draft:

UnicodeString & UnicodeString::operator+= (UChar ch) [inline]

Append operator.

Append the code unit ch to the UnicodeString object.

Parameters:
ch   the code unit to be appended
Returns:
a reference to this
Draft:

Definition at line 2601 of file unistr.h.

UnicodeString & UnicodeString::operator+= (UChar32 ch) [inline]

Append operator.

Append the code point ch to the UnicodeString object.

Parameters:
ch   the code point to be appended
Returns:
a reference to this
Draft:

Definition at line 2605 of file unistr.h.

UnicodeString & UnicodeString::operator+= (const UnicodeString & srcText) [inline]

Append operator.

Append the characters in srcText to the UnicodeString object at offset start. srcText is not modified.

Parameters:
srcText   the source for the new characters
Returns:
a reference to this
Stable:

Definition at line 2613 of file unistr.h.

UnicodeString & UnicodeString::append (const UnicodeString & srcText, UTextOffset srcStart, int32_t srcLength) [inline]

Append the characters in srcText in the range [srcStart, srcStart + srcLength) to the UnicodeString object at offset start.

srcText is not modified.

Parameters:
srcText   the source for the new characters
srcStart   the offset into srcText where new characters will be obtained
srcLength   the number of characters in srcText in the append string
Returns:
a reference to this
Stable:

Definition at line 2617 of file unistr.h.

UnicodeString & UnicodeString::append (const UnicodeString & srcText) [inline]

Append the characters in srcText to the UnicodeString object at offset start.

srcText is not modified.

Parameters:
srcText   the source for the new characters
Returns:
a reference to this
Stable:

Definition at line 2623 of file unistr.h.

UnicodeString & UnicodeString::append (const UChar * srcChars, UTextOffset srcStart, int32_t srcLength) [inline]

Append the characters in srcChars in the range [srcStart, srcStart + srcLength) to the UnicodeString object at offset start.

srcChars is not modified.

Parameters:
srcChars   the source for the new characters
srcStart   the offset into srcChars where new characters will be obtained
srcLength   the number of characters in srcChars in the append string
Returns:
a reference to this
Stable:

Definition at line 2627 of file unistr.h.

UnicodeString & UnicodeString::append (const UChar * srcChars, int32_t srcLength) [inline]

Append the characters in srcChars to the UnicodeString object at offset start.

srcChars is not modified.

Parameters:
srcChars   the source for the new characters
srcLength   the number of Unicode characters in srcChars
Returns:
a reference to this
Stable:

Definition at line 2633 of file unistr.h.

UnicodeString & UnicodeString::append (UChar srcChar) [inline]

Append the code point srcChar to the UnicodeString object.

Parameters:
srcChar   the code unit to append
Returns:
a reference to this
Draft:

Definition at line 2638 of file unistr.h.

UnicodeString & UnicodeString::append (UChar32 srcChar) [inline]

Append the code point srcChar to the UnicodeString object.

Parameters:
srcChar   the code point to append
Returns:
a reference to this
Draft:

Definition at line 2642 of file unistr.h.

UnicodeString & UnicodeString::insert (UTextOffset start, const UnicodeString & srcText, UTextOffset srcStart, int32_t srcLength) [inline]

Insert the characters in srcText in the range [srcStart, srcStart + srcLength) into the UnicodeString object at offset start.

srcText is not modified.

Parameters:
start   the offset where the insertion begins
srcText   the source for the new characters
srcStart   the offset into srcText where new characters will be obtained
srcLength   the number of characters in srcText in the insert string
Returns:
a reference to this
Stable:

Definition at line 2650 of file unistr.h.

UnicodeString & UnicodeString::insert (UTextOffset start, const UnicodeString & srcText) [inline]

Insert the characters in srcText into the UnicodeString object at offset start.

srcText is not modified.

Parameters:
start   the offset where the insertion begins
srcText   the source for the new characters
Returns:
a reference to this
Stable:

Definition at line 2657 of file unistr.h.

UnicodeString & UnicodeString::insert (UTextOffset start, const UChar * srcChars, UTextOffset srcStart, int32_t srcLength) [inline]

Insert the characters in srcChars in the range [srcStart, srcStart + srcLength) into the UnicodeString object at offset start.

srcChars is not modified.

Parameters:
start   the offset at which the insertion begins
srcChars   the source for the new characters
srcStart   the offset into srcChars where new characters will be obtained
srcLength   the number of characters in srcChars in the insert string
Returns:
a reference to this
Stable:

Definition at line 2650 of file unistr.h.

UnicodeString & UnicodeString::insert (UTextOffset start, const UChar * srcChars, int32_t srcLength) [inline]

Insert the characters in srcChars into the UnicodeString object at offset start.

srcChars is not modified.

Parameters:
start   the offset where the insertion begins
srcChars   the source for the new characters
srcLength   the number of Unicode characters in srcChars.
Returns:
a reference to this
Stable:

Definition at line 2669 of file unistr.h.

UnicodeString & UnicodeString::insert (UTextOffset start, UChar srcChar) [inline]

Insert the code point srcChar into the UnicodeString object at offset start.

Parameters:
start   the offset at which the insertion occurs
srcChar   the code unit to insert
Returns:
a reference to this
Draft:

Definition at line 2675 of file unistr.h.

UnicodeString & UnicodeString::insert (UTextOffset start, UChar32 srcChar) [inline]

Insert the code point srcChar into the UnicodeString object at offset start.

Parameters:
start   the offset at which the insertion occurs
srcChar   the code point to insert
Returns:
a reference to this
Draft:

Definition at line 2657 of file unistr.h.

UnicodeString & UnicodeString::replace (UTextOffset start, int32_t length, const UnicodeString & srcText, UTextOffset srcStart, int32_t srcLength) [inline]

Replace the characters in the range [start, start + length) with the characters in srcText in the range [srcStart, srcStart + srcLength).

srcText is not modified.

Parameters:
start   the offset at which the replace operation begins
length   the number of characters to replace. The character at start + length is not modified.
srcText   the source for the new characters
srcStart   the offset into srcText where new characters will be obtained
srcLength   the number of characters in srcText in the replace string
Returns:
a reference to this
Stable:

Definition at line 2400 of file unistr.h.

UnicodeString & UnicodeString::replace (UTextOffset start, int32_t length, const UnicodeString & srcText) [inline]

Replace the characters in the range [start, start + length) with the characters in srcText.

srcText is not modified.

Parameters:
start   the offset at which the replace operation begins
length   the number of characters to replace. The character at start + length is not modified.
srcText   the source for the new characters
Returns:
a reference to this
Stable:

Definition at line 2394 of file unistr.h.

UnicodeString & UnicodeString::replace (UTextOffset start, int32_t length, const UChar * srcChars, UTextOffset srcStart, int32_t srcLength) [inline]

Replace the characters in the range [start, start + length) with the characters in srcChars in the range [srcStart, srcStart + srcLength).

srcChars is not modified.

Parameters:
start   the offset at which the replace operation begins
length   the number of characters to replace. The character at start + length is not modified.
srcChars   the source for the new characters
srcStart   the offset into srcChars where new characters will be obtained
srcLength   the number of characters in srcChars in the replace string
Returns:
a reference to this
Stable:

Definition at line 2400 of file unistr.h.

UnicodeString & UnicodeString::replace (UTextOffset start, int32_t length, const UChar * srcChars, int32_t srcLength) [inline]

Replace the characters in the range [start, start + length) with the characters in srcChars.

srcChars is not modified.

Parameters:
start   the offset at which the replace operation begins
length   number of characters to replace. The character at start + length is not modified.
srcChars   the source for the new characters
srcLength   the number of Unicode characters in srcChars
Returns:
a reference to this
Stable:

Definition at line 2408 of file unistr.h.

UnicodeString & UnicodeString::replace (UTextOffset start, int32_t length, const UnicodeString & srcText) [inline]

Replace the characters in the range [start, start + length) with the characters in srcText.

Parameters:
start   the offset at which the replace operation begins
length   the number of characters to replace. The character at start + length is not modified.
srcChar   the new code unit
Returns:
a reference to this
Draft:

Definition at line 2394 of file unistr.h.

UnicodeString & UnicodeString::replace (UTextOffset start, int32_t length, const UnicodeString & srcText) [inline]

Replace the characters in the range [start, start + length) with the code point srcChar.

Parameters:
start   the offset at which the replace operation begins
length   the number of characters to replace. The character at start + length is not modified.
srcChar   the new code point
Returns:
a reference to this
Draft:

Definition at line 2394 of file unistr.h.

UnicodeString & UnicodeString::replaceBetween (UTextOffset start, UTextOffset limit, const UnicodeString & srcText) [inline]

Replace the characters in the range [start, limit) with the characters in srcText.

srcText is not modified.

Parameters:
start   the offset at which the replace operation begins
limit   the offset immediately following the replace range
srcText   the source for the new characters
Returns:
a reference to this
Stable:

Definition at line 2439 of file unistr.h.

UnicodeString & UnicodeString::replaceBetween (UTextOffset start, UTextOffset limit, const UnicodeString & srcText, UTextOffset srcStart, UTextOffset srcLimit) [inline]

Replace the characters in the range [start, limit) with the characters in srcText in the range [srcStart, srcLimit).

srcText is not modified.

Parameters:
start   the offset at which the replace operation begins
limit   the offset immediately following the replace range
srcText   the source for the new characters
srcStart   the offset into srcChars where new characters will be obtained
srcLimit   the offset immediately following the range to copy in srcText
Returns:
a reference to this
Stable:

Definition at line 2445 of file unistr.h.

virtual void UnicodeString::handleReplaceBetween (UTextOffset start, UTextOffset limit, const UnicodeString & text) [virtual]

Replace a substring of this object with the given text.

Parameters:
start   the beginning index, inclusive; 0 <= start <= limit.
limit   the ending index, exclusive; start <= limit <= length().
text   the text to replace characters start to limit - 1
Stable:

Reimplemented from Replaceable.

virtual void UnicodeString::copy (int32_t start, int32_t limit, int32_t dest) [virtual]

Copy a substring of this object, retaining attribute (out-of-band) information.

This method is used to duplicate or reorder substrings. The destination index must not overlap the source range.

Parameters:
start   the beginning index, inclusive; 0 <= start <= limit.
limit   the ending index, exclusive; start <= limit <= length().
dest   the destination index. The characters from start..limit-1 will be copied to dest. Implementations of this method may assume that dest <= start || dest >= limit.

Reimplemented from Replaceable.

UnicodeString & UnicodeString::findAndReplace (const UnicodeString & oldText, const UnicodeString & newText) [inline]

Replace all occurrences of characters in oldText with the characters in newText.

Parameters:
oldText   the text containing the search text
newText   the text containing the replacement text
Returns:
a reference to this
Stable:

Definition at line 2453 of file unistr.h.

UnicodeString & UnicodeString::findAndReplace (UTextOffset start, int32_t length, const UnicodeString & oldText, const UnicodeString & newText) [inline]

Replace all occurrences of characters in oldText with characters in newText in the range [start, start + length).

Parameters:
start   the start of the range in which replace will performed
length   the length of the range in which replace will be performed
oldText   the text containing the search text
newText   the text containing the replacement text
Returns:
a reference to this
Stable:

Definition at line 2459 of file unistr.h.

UnicodeString & UnicodeString::findAndReplace (UTextOffset start, int32_t length, const UnicodeString & oldText, UTextOffset oldStart, int32_t oldLength, const UnicodeString & newText, UTextOffset newStart, int32_t newLength)

Replace all occurrences of characters in oldText in the range [oldStart, oldStart + oldLength) with the characters in newText in the range [newStart, newStart + newLength) in the range [start, start + length).

Parameters:
start   the start of the range in which replace will performed
length   the length of the range in which replace will be performed
oldText   the text containing the search text
oldStart   the start of the search range in oldText
oldLength   the length of the search range in oldText
newText   the text containing the replacement text
newStart   the start of the replacement range in newText
newLength   the length of the replacement range in newText
Returns:
a reference to this
Stable:

UnicodeString & UnicodeString::remove (void) [inline]

Remove all characters from the UnicodeString object.

Returns:
a reference to this
Stable:

Definition at line 2691 of file unistr.h.

UnicodeString & UnicodeString::remove (UTextOffset start, int32_t length = INT32_MAX) [inline]

Remove the characters in the range [start, start + length) from the UnicodeString object.

Parameters:
start   the offset of the first character to remove
length   the number of characters to remove
Returns:
a reference to this
Stable:

Definition at line 2686 of file unistr.h.

UnicodeString & UnicodeString::removeBetween (UTextOffset start, UTextOffset limit = INT32_MAX) [inline]

Remove the characters in the range [start, limit) from the UnicodeString object.

Parameters:
start   the offset of the first character to remove
limit   the offset immediately following the range to remove
Returns:
a reference to this
Stable:

Definition at line 2695 of file unistr.h.

UBool UnicodeString::padLeading (int32_t targetLength, UChar padChar = 0x0020)

Pad the start of this UnicodeString with the character padChar.

If the length of this UnicodeString is less than targetLength, length() - targetLength copies of padChar will be added to the beginning of this UnicodeString.

Parameters:
targetLength   the desired length of the string
padChar   the character to use for padding. Defaults to space (U+0020)
Returns:
TRUE if the text was padded, FALSE otherwise.
Draft:

UBool UnicodeString::padTrailing (int32_t targetLength, UChar padChar = 0x0020)

Pad the end of this UnicodeString with the character padChar.

If the length of this UnicodeString is less than targetLength, length() - targetLength copies of padChar will be added to the end of this UnicodeString.

Parameters:
targetLength   the desired length of the string
padChar   the character to use for padding. Defaults to space (U+0020)
Returns:
TRUE if the text was padded, FALSE otherwise.
Draft:

UBool UnicodeString::truncate (int32_t targetLength) [inline]

Truncate this UnicodeString to the targetLength.

Parameters:
targetLength   the desired length of this UnicodeString.
Returns:
TRUE if the text was truncated, FALSE otherwise
Stable:

Definition at line 2700 of file unistr.h.

UnicodeString & UnicodeString::trim (void)

Trims leading and trailing whitespace from this UnicodeString.

Returns:
a reference to this
Stable:

UnicodeString & UnicodeString::reverse (void) [inline]

Reverse this UnicodeString in place.

Returns:
a reference to this
Stable:

Definition at line 2711 of file unistr.h.

UnicodeString & UnicodeString::reverse (UTextOffset start, int32_t length) [inline]

Reverse the range [start, start + length) in this UnicodeString.

Parameters:
start   the start of the range to reverse
length   the number of characters to to reverse
Returns:
a reference to this
Stable:

Definition at line 2715 of file unistr.h.

UnicodeString & UnicodeString::toUpper (void)

Convert the characters in this to UPPER CASE following the conventions of the default locale.

Returns:
A reference to this.
Stable:

UnicodeString & UnicodeString::toUpper (const Locale & locale)

Convert the characters in this to UPPER CASE following the conventions of a specific locale.

Parameters:
locale   The locale containing the conventions to use.
Returns:
A reference to this.
Stable:

UnicodeString & UnicodeString::toLower (void)

Convert the characters in this to UPPER CASE following the conventions of the default.

Returns:
A reference to this.
Stable:

UnicodeString & UnicodeString::toLower (const Locale & locale)

Convert the characters in this to UPPER CASE following the conventions of a specific locale.

Parameters:
locale   The locale containing the conventions to use.
Returns:
A reference to this.
Stable:

UnicodeString::UnicodeString ()

Construct an empty UnicodeString.

Stable:

UnicodeString::UnicodeString (int32_t capacity, UChar32 c, int32_t count)

Construct a UnicodeString with capacity to hold capacity UChars.

Parameters:
capacity   the number of UChars this UnicodeString should hold before a resize is necessary; if count is greater than 0 and count code points c take up more space than capacity, then capacity is adjusted accordingly.
c   is used to initially fill the string
count   specifies how many code points c are to be written in the string
Draft:

UnicodeString::UnicodeString (UChar ch)

Single UChar32 (code point) constructor.

Parameters:
ch   the character to place in the UnicodeString
Draft:

UnicodeString::UnicodeString (UChar32 ch)

Single UChar32 (code point) constructor.

Parameters:
ch   the character to place in the UnicodeString
Draft:

UnicodeString::UnicodeString (const UChar * text)

UChar* constructor.

Parameters:
text   The characters to place in the UnicodeString. text must be NULL (U+0000) terminated.
Stable:

UnicodeString::UnicodeString (const UChar * text, int32_t textLength)

UChar* constructor.

Parameters:
text   The characters to place in the UnicodeString.
textLength   The number of Unicode characters in text to copy.
Stable:

UnicodeString::UnicodeString (UBool isTerminated, const UChar * text, int32_t textLength)

Readonly-aliasing UChar* constructor.

The text will be used for the UnicodeString object, but it will not be released when the UnicodeString is destroyed. This has copy-on-write semantics: When the string is modified, then the buffer is first copied into newly allocated memory. The aliased buffer is never modified. In an assignment to another UnicodeString, the text will be aliased again, so that both strings then alias the same readonly-text.

Parameters:
isTerminated   specifies if text is NUL-terminated. This must be true if textLength==-1.
text   The characters to alias for the UnicodeString.
textLength   The number of Unicode characters in text to alias. If -1, then this constructor will determine the length by calling u_strlen().
Stable:

UnicodeString::UnicodeString (UChar * buffer, int32_t buffLength, int32_t buffCapacity)

Writeable-aliasing UChar* constructor.

The text will be used for the UnicodeString object, but it will not be released when the UnicodeString is destroyed. This has write-through semantics: For as long as the capacity of the buffer is sufficient, write operations will directly affect the buffer. When more capacity is necessary, then a new buffer will be allocated and the contents copied as with regularly constructed strings. In an assignment to another UnicodeString, the buffer will be copied. The extract(UChar *dst) function detects whether the dst pointer is the same as the string buffer itself and will in this case not copy the contents.

Parameters:
buffer   The characters to alias for the UnicodeString.
buffLength   The number of Unicode characters in buffer to alias.
buffCapacity   The size of buffer in UChars.
Draft:

UnicodeString::UnicodeString (const char * codepageData, const char * codepage = 0)

char* constructor.

Parameters:
codepageData   an array of bytes, null-terminated
codepage   the encoding of codepageData. The special value 0 for codepage indicates that the text is in the platform's default codepage. If codepage is an empty string (""), then a simple conversion is performed on the codepage-invariant subset ("invariant characters") of the platform encoding. See utypes.h.
Stable:

UnicodeString::UnicodeString (const char * codepageData, int32_t dataLength, const char * codepage = 0)

char* constructor.

Parameters:
codepageData   an array of bytes.
dataLength   The number of bytes in codepageData.
codepage   the encoding of codepageData. The special value 0 for codepage indicates that the text is in the platform's default codepage. If codepage is an empty string (""), then a simple conversion is performed on the codepage-invariant subset ("invariant characters") of the platform encoding. See utypes.h.
Stable:

UnicodeString::UnicodeString (const UnicodeString & that)

Copy constructor.

Parameters:
that   The UnicodeString object to copy.
Stable:

UnicodeString::~UnicodeString ()

Destructor.

Stable:

int32_t UnicodeString::numDisplayCells (UTextOffset start = 0, int32_t length = INT32_MAX, UBool asian = TRUE) const

Returns the number of display cells occupied by the range [start, length).

This function is designed for Asian text and properly takes into account halfwidth and fullwidth variants of various CJK characters and the combining behavior of the Hangul Jamo characters (with some limitations; see documentation for Unicode::getCellWidth()).
In order to avoid dealing with fractions, this function can either be construed to return twice the actual number of display cells or to treat a "cell" as the width of a halfwidth character rather than the width of a fullwidth character.

Parameters:
start   the start of the range
length   the number of characters to measure
asian   The asian parameter controls whether characters considered NEUTRAL by the Unicode class are treated as halfwidth or fullwidth here. If you set asian to FALSE, neutrals are treated as halfwidth, and this function returns a close approximation of how many Latin display cells the text will take up in a monospaced font.
Returns:
the number of display cells occupied by the specified substring.
Stable:

UCharReference UnicodeString::operator[] (UTextOffset pos)

int32_t UnicodeString::size (void) const [inline]

Definition at line 2787 of file unistr.h.

UnicodeString & UnicodeString::findAndReplace (const UnicodeString & oldText, const UnicodeString & newText, UTextOffset start, int32_t length) [inline]

Definition at line 2791 of file unistr.h.

void * UnicodeString::operator new (size_t size) [inline]

Definition at line 2798 of file unistr.h.

void * UnicodeString::operator new (size_t size, void * location) [inline]

Definition at line 2802 of file unistr.h.

void UnicodeString::operator delete (void * location) [inline]

Definition at line 2807 of file unistr.h.

const UChar* UnicodeString::getUChars () const


Friends And Related Function Documentation

friend class UnicodeStringStreamer [friend]

Definition at line 1970 of file unistr.h.

friend class UnicodeConverterCPP [friend]

Definition at line 1971 of file unistr.h.

friend class StringCharacterIterator [friend]

Definition at line 1978 of file unistr.h.


The documentation for this class was generated from the following file:
Generated at Mon Jun 5 12:53:29 2000 for ICU1.5 by doxygen 1.0.0 written by Dimitri van Heesch, © 1997-1999