Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members   Search  

UnicodeString Class Reference

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

#include <unistr.h>

Inheritance diagram for UnicodeString::

Replaceable UObject List of all members.

Public Methods

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 (int32_t 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 (int32_t start, int32_t length, const UnicodeString &srcText, int32_t 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 (int32_t 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 (int32_t start, int32_t length, const UChar *srcChars, int32_t 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 (int32_t start, int32_t limit, const UnicodeString &srcText, int32_t srcStart, int32_t srcLimit) const
 Compare the characters bitwise in the range [start, limit) with the characters in srcText in the range [srcStart, srcLimit). More...

int8_t compareCodePointOrder (const UnicodeString &text) const
 Compare two Unicode strings in code point order. More...

int8_t compareCodePointOrder (int32_t start, int32_t length, const UnicodeString &srcText) const
 Compare two Unicode strings in code point order. More...

int8_t compareCodePointOrder (int32_t start, int32_t length, const UnicodeString &srcText, int32_t srcStart, int32_t srcLength) const
 Compare two Unicode strings in code point order. More...

int8_t compareCodePointOrder (const UChar *srcChars, int32_t srcLength) const
 Compare two Unicode strings in code point order. More...

int8_t compareCodePointOrder (int32_t start, int32_t length, const UChar *srcChars) const
 Compare two Unicode strings in code point order. More...

int8_t compareCodePointOrder (int32_t start, int32_t length, const UChar *srcChars, int32_t srcStart, int32_t srcLength) const
 Compare two Unicode strings in code point order. More...

int8_t compareCodePointOrderBetween (int32_t start, int32_t limit, const UnicodeString &srcText, int32_t srcStart, int32_t srcLimit) const
 Compare two Unicode strings in code point order. More...

int8_t caseCompare (const UnicodeString &text, uint32_t options) const
 Compare two strings case-insensitively using full case folding. More...

int8_t caseCompare (int32_t start, int32_t length, const UnicodeString &srcText, uint32_t options) const
 Compare two strings case-insensitively using full case folding. More...

int8_t caseCompare (int32_t start, int32_t length, const UnicodeString &srcText, int32_t srcStart, int32_t srcLength, uint32_t options) const
 Compare two strings case-insensitively using full case folding. More...

int8_t caseCompare (const UChar *srcChars, int32_t srcLength, uint32_t options) const
 Compare two strings case-insensitively using full case folding. More...

int8_t caseCompare (int32_t start, int32_t length, const UChar *srcChars, uint32_t options) const
 Compare two strings case-insensitively using full case folding. More...

int8_t caseCompare (int32_t start, int32_t length, const UChar *srcChars, int32_t srcStart, int32_t srcLength, uint32_t options) const
 Compare two strings case-insensitively using full case folding. More...

int8_t caseCompareBetween (int32_t start, int32_t limit, const UnicodeString &srcText, int32_t srcStart, int32_t srcLimit, uint32_t options) const
 Compare two strings case-insensitively using full case folding. More...

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

UBool startsWith (const UnicodeString &srcText, int32_t 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, int32_t 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, int32_t 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, int32_t srcStart, int32_t srcLength) const
 Determine if this ends with the characters in srcChars in the range [srcStart, srcStart + srcLength). More...

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

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

int32_t indexOf (const UnicodeString &text, int32_t 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...

int32_t indexOf (const UnicodeString &srcText, int32_t srcStart, int32_t srcLength, int32_t 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...

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

int32_t indexOf (const UChar *srcChars, int32_t srcLength, int32_t 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...

int32_t indexOf (const UChar *srcChars, int32_t srcStart, int32_t srcLength, int32_t 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...

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

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

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

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

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

int32_t indexOf (UChar32 c, int32_t 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...

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

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

int32_t lastIndexOf (const UnicodeString &text, int32_t 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...

int32_t lastIndexOf (const UnicodeString &srcText, int32_t srcStart, int32_t srcLength, int32_t 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...

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

int32_t lastIndexOf (const UChar *srcChars, int32_t srcLength, int32_t 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...

int32_t lastIndexOf (const UChar *srcChars, int32_t srcStart, int32_t srcLength, int32_t 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...

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

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

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

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

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

int32_t lastIndexOf (UChar32 c, int32_t 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 (int32_t offset) const
 Return the code unit at offset offset. More...

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

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

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

int32_t getCharStart (int32_t offset) const
 Same as getChar32Start(). More...

int32_t getChar32Limit (int32_t offset) const
 Adjust a random-access offset so that it points behind a Unicode character. More...

int32_t getCharLimit (int32_t offset) const
 Same as getChar32Limit(). More...

int32_t moveIndex32 (int32_t index, int32_t delta) const
 Move the code unit index along the string by delta code points. More...

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

int32_t extract (UChar *dest, int32_t destCapacity, UErrorCode &errorCode) const
 Copy the contents of the string into dest. More...

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

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

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

int32_t extract (int32_t start, int32_t startLength, char *target, 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 extract (int32_t start, int32_t startLength, char *target, uint32_t targetLength, 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 extract (char *dest, int32_t destCapacity, UConverter *cnv, UErrorCode &errorCode) const
 Convert the UnicodeString into a codepage string using an existing UConverter. More...

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

int32_t countChar32 (int32_t start=0, int32_t length=0x7fffffff) const
 Count Unicode code points in the length UChar code units of the string. More...

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

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

int32_t getCapacity (void) const
 Return the capacity of the internal buffer of the UnicodeString object. 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, int32_t srcStart)
 Set the text in the UnicodeString object to the characters in srcText in the range [srcStart, srcText.length()). More...

UnicodeString & setTo (const UnicodeString &srcText, int32_t 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 unit 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 writable-aliasing UChar* constructor. More...

void setToBogus ()
 Make this UnicodeString object invalid. More...

UnicodeString & setCharAt (int32_t 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, int32_t 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, int32_t 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 unit srcChar to the UnicodeString object. More...

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

UnicodeString & insert (int32_t start, const UnicodeString &srcText, int32_t 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 (int32_t start, const UnicodeString &srcText)
 Insert the characters in srcText into the UnicodeString object at offset start. More...

UnicodeString & insert (int32_t start, const UChar *srcChars, int32_t 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 (int32_t start, const UChar *srcChars, int32_t srcLength)
 Insert the characters in srcChars into the UnicodeString object at offset start. More...

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

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

UnicodeString & replace (int32_t start, int32_t length, const UnicodeString &srcText, int32_t 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 (int32_t start, int32_t length, const UnicodeString &srcText)
 Replace the characters in the range [start, start + length) with the characters in srcText. More...

UnicodeString & replace (int32_t start, int32_t length, const UChar *srcChars, int32_t 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 (int32_t 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 (int32_t start, int32_t length, UChar srcChar)
 Replace the characters in the range [start, start + length) with the code unit srcChar. More...

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

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

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

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

virtual UBool hasMetaData () const
 Replaceable API. 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 (int32_t 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 (int32_t start, int32_t length, const UnicodeString &oldText, int32_t oldStart, int32_t oldLength, const UnicodeString &newText, int32_t 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 (int32_t start, int32_t length=(int32_t) INT32_MAX)
 Remove the characters in the range [start, start + length) from the UnicodeString object. More...

UnicodeString & removeBetween (int32_t start, int32_t limit=(int32_t) 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 (int32_t 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 lower case following the conventions of the default locale. More...

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

UnicodeString & toTitle (BreakIterator *titleIter)
 Titlecase this string, convenience function using the default locale. More...

UnicodeString & toTitle (BreakIterator *titleIter, const Locale &locale)
 Titlecase this string. More...

UnicodeString & foldCase (uint32_t options=0)
 Case-fold the characters in this string. More...

UChar * getBuffer (int32_t minCapacity)
 Get a read/write pointer to the internal buffer. More...

void releaseBuffer (int32_t newLength=-1)
 Release a read/write buffer on a UnicodeString object with an "open" getBuffer(minCapacity). More...

const UChar * getBuffer () const
 Get a read-only pointer to the internal buffer. More...

const UChar * getTerminatedBuffer ()
 Get a read-only pointer to the internal buffer, making sure that it is NUL-terminated. 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 UChar (code unit) 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)
 Writable-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 char *src, int32_t srcLength, UConverter *cnv, UErrorCode &errorCode)
 char * / UConverter constructor. More...

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

 UnicodeString (const UnicodeString &src, int32_t srcStart)
 'Substring' constructor from tail of source string. More...

 UnicodeString (const UnicodeString &src, int32_t srcStart, int32_t srcLength)
 'Substring' constructor from subrange of source string. More...

 ~UnicodeString ()
 Destructor. More...

int32_t numDisplayCells (int32_t 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[] (int32_t pos)
 Return a modifiable reference to a code unit of the string. More...

UnicodeString unescape () const
 Unescape a string of characters and return a string containing the result. More...

UChar32 unescapeAt (int32_t &offset) const
 Unescape a single escape sequence and return the represented character. More...

virtual UClassID getDynamicClassID () const
 ICU "poor man's RTTI", returns a UClassID for the actual class. More...


Static Public Methods

UClassID getStaticClassID ()
 ICU "poor man's RTTI", returns a UClassID for this class. More...


Protected Methods

virtual int32_t getLength () const
 Implement Replaceable::getLength() (see jitterbug 1027). More...

virtual UChar getCharAt (int32_t offset) const
 The change in Replaceable to use virtual getCharAt() allows UnicodeString::charAt() to be inline again (see jitterbug 709). More...

virtual UChar32 getChar32At (int32_t offset) const
 The change in Replaceable to use virtual getChar32At() allows UnicodeString::char32At() to be inline again (see jitterbug 709). More...


Private Types

enum  {
  US_STACKBUF_SIZE = 3, kInvalidUChar = 0xffff, kGrowSize = 128, kInvalidHashCode = 0,
  kEmptyHashCode = 1, kIsBogus = 1, kUsingStackBuffer = 2, kRefCounted = 4,
  kBufferIsReadonly = 8, kOpenGetBuffer = 16, kShortString = kUsingStackBuffer, kLongString = kRefCounted,
  kReadonlyAlias = kBufferIsReadonly, kWritableAlias = 0
}

Private Methods

int8_t doCompare (int32_t start, int32_t length, const UnicodeString &srcText, int32_t srcStart, int32_t srcLength) const
int8_t doCompare (int32_t start, int32_t length, const UChar *srcChars, int32_t srcStart, int32_t srcLength) const
int8_t doCompareCodePointOrder (int32_t start, int32_t length, const UnicodeString &srcText, int32_t srcStart, int32_t srcLength) const
int8_t doCompareCodePointOrder (int32_t start, int32_t length, const UChar *srcChars, int32_t srcStart, int32_t srcLength) const
int8_t doCaseCompare (int32_t start, int32_t length, const UnicodeString &srcText, int32_t srcStart, int32_t srcLength, uint32_t options) const
int8_t doCaseCompare (int32_t start, int32_t length, const UChar *srcChars, int32_t srcStart, int32_t srcLength, uint32_t options) const
int32_t doIndexOf (UChar c, int32_t start, int32_t length) const
int32_t doIndexOf (UChar32 c, int32_t start, int32_t length) const
int32_t doLastIndexOf (UChar c, int32_t start, int32_t length) const
int32_t doLastIndexOf (UChar32 c, int32_t start, int32_t length) const
void doExtract (int32_t start, int32_t length, UChar *dst, int32_t dstStart) const
void doExtract (int32_t start, int32_t length, UnicodeString &target) const
UChar doCharAt (int32_t offset) const
UnicodeString & doReplace (int32_t start, int32_t length, const UnicodeString &srcText, int32_t srcStart, int32_t srcLength)
UnicodeString & doReplace (int32_t start, int32_t length, const UChar *srcChars, int32_t srcStart, int32_t srcLength)
UnicodeString & doReverse (int32_t start, int32_t length)
int32_t doHashCode (void) const
UChar * getArrayStart (void)
const UChar * getArrayStart (void) const
UBool allocate (int32_t capacity)
void releaseArray (void)
void pinIndices (int32_t &start, int32_t &length) const
int32_t doExtract (int32_t start, int32_t length, char *dest, int32_t destCapacity, UConverter *cnv, UErrorCode &errorCode) const
void doCodepageCreate (const char *codepageData, int32_t dataLength, const char *codepage)
void doCodepageCreate (const char *codepageData, int32_t dataLength, UConverter *converter, UErrorCode &status)
UBool cloneArrayIfNeeded (int32_t newCapacity=-1, int32_t growCapacity=-1, UBool doCopyArray=TRUE, int32_t **pBufferToDelete=0, UBool forceClone=FALSE)
UnicodeString & caseMap (BreakIterator *titleIter, const Locale &locale, uint32_t options, int32_t toWhichCase)
void addRef (void)
int32_t removeRef (void)
int32_t refCount (void) const
int32_t setRefCount (int32_t count)

Private Attributes

int32_t fLength
int32_t fCapacity
UChar * fArray
uint16_t fFlags
UChar fStackBuffer [US_STACKBUF_SIZE]

Static Private Attributes

const char fgClassID
 The address of this static class variable serves as this class's ID for ICU "poor man's RTTI". More...


Friends

class UnicodeConverter
class StringCharacterIterator
class StringThreadTest

Detailed Description

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

It is a concrete implementation of the abstract class Replaceable (for transliteration).

In ICU, strings are stored and used as UTF-16. This means that a string internally consists of 16-bit Unicode code units.
UTF-16 is a variable-length encoding: A Unicode character may be stored with either one code unit &mdash; which is the most common case &mdash; or with a matched pair of special code units ("surrogates"). The data type for code units is UChar.
For single-character handling, a Unicode character code point is a scalar value in the range 0..0x10ffff. ICU uses the UChar32 type for code points.

Indexes and offsets into and lengths of strings always count code units, not code points. This is the same as with multi-byte char* strings in traditional string handling. Operations on partial strings typically do not test for code point boundaries. If necessary, the user needs to take care of such boundaries by testing for the code unit values or by using functions like UnicodeString::getChar32Start() and UnicodeString::getChar32Limit() (or, in C, the equivalent macros UTF_SET_CHAR_START() and UTF_SET_CHAR_LIMIT(), see utf.h).

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 writable 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 writable 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 writable 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.

See also:
Unicode
Stable:

Definition at line 156 of file unistr.h.


Member Enumeration Documentation

anonymous enum [private]
 

Enumeration values:
US_STACKBUF_SIZE 
kInvalidUChar 
kGrowSize 
kInvalidHashCode 
kEmptyHashCode 
kIsBogus 
kUsingStackBuffer 
kRefCounted 
kBufferIsReadonly 
kOpenGetBuffer 
kShortString 
kLongString 
kReadonlyAlias 
kWritableAlias 

Definition at line 3060 of file unistr.h.


Constructor & Destructor Documentation

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
Stable:

UnicodeString::UnicodeString UChar    ch
 

Single UChar (code unit) constructor.

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

UnicodeString::UnicodeString UChar32    ch
 

Single UChar32 (code point) constructor.

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

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
 

Writable-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.
Stable:

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 char *    src,
int32_t    srcLength,
UConverter   cnv,
UErrorCode   errorCode
 

char * / UConverter constructor.

This constructor uses an existing UConverter object to convert the codepage string to Unicode and construct a UnicodeString from that.

The converter is reset at first. If the error code indicates a failure before this constructor is called, or if an error occurs during conversion or construction, then the string will be bogus.

This function avoids the overhead of opening and closing a converter if multiple strings are constructed.

Parameters:
src  input codepage string
srcLength  length of the input string, can be -1 for NUL-terminated strings
cnv  converter object (ucnv_resetToUnicode() will be called), can be NULL for the default converter
errorCode  normal ICU error code
Draft:
This API has been introduced in ICU 2.0. It is still in draft state and may be modified in a future release.

UnicodeString::UnicodeString const UnicodeString &    that
 

Copy constructor.

Parameters:
that  The UnicodeString object to copy.
Stable:

UnicodeString::UnicodeString const UnicodeString &    src,
int32_t    srcStart
 

'Substring' constructor from tail of source string.

Parameters:
src  The UnicodeString object to copy.
srcStart  The offset into src at which to start copying.
Draft:
This API has been introduced in ICU2.2. It is still in draft state and may be modified in a future release.

UnicodeString::UnicodeString const UnicodeString &    src,
int32_t    srcStart,
int32_t    srcLength
 

'Substring' constructor from subrange of source string.

Parameters:
src  The UnicodeString object to copy.
srcStart  The offset into src at which to start copying.
srcLength  The number of characters from src to copy.
Draft:
This API has been introduced in ICU2.2. It is still in draft state and may be modified in a future release.

UnicodeString::~UnicodeString  
 

Destructor.

Stable:


Member Function Documentation

void UnicodeString::addRef void    [private]
 

UBool UnicodeString::allocate int32_t    capacity [private]
 

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
Stable:

Definition at line 3895 of file unistr.h.

UnicodeString & UnicodeString::append UChar    srcChar [inline]
 

Append the code unit srcChar to the UnicodeString object.

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

Definition at line 3891 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 3886 of file unistr.h.

UnicodeString & UnicodeString::append const UChar *    srcChars,
int32_t    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 3880 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 3876 of file unistr.h.

UnicodeString & UnicodeString::append const UnicodeString &    srcText,
int32_t    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 3870 of file unistr.h.

int8_t UnicodeString::caseCompare int32_t    start,
int32_t    length,
const UChar *    srcChars,
int32_t    srcStart,
int32_t    srcLength,
uint32_t    options
const [inline]
 

Compare two strings case-insensitively using full case folding.

This is equivalent to this->foldCase(options).compare(srcChars.foldCase(options)).

Parameters:
start  The start offset in this string at which the compare operation begins.
length  The number of code units from this string to compare.
srcChars  A pointer to another string to compare this one to.
srcStart  The start offset in that string at which the compare operation begins.
srcLength  The number of code units from that string to compare.
options  A bit set of options:
  • U_FOLD_CASE_DEFAULT or 0 is used for default options: Comparison in code unit order with default case folding.
  • U_COMPARE_CODE_POINT_ORDER Set to choose code point order instead of code unit order (see u_strCompare for details).
  • U_FOLD_CASE_EXCLUDE_SPECIAL_I
Returns:
A negative, zero, or positive integer indicating the comparison result.
Stable:

Definition at line 3342 of file unistr.h.

int8_t UnicodeString::caseCompare int32_t    start,
int32_t    length,
const UChar *    srcChars,
uint32_t    options
const [inline]
 

Compare two strings case-insensitively using full case folding.

This is equivalent to this->foldCase(options).compare(srcChars.foldCase(options)).

Parameters:
start  The start offset in this string at which the compare operation begins.
length  The number of code units from this string to compare.
srcChars  A pointer to another string to compare this one to.
options  A bit set of options:
  • U_FOLD_CASE_DEFAULT or 0 is used for default options: Comparison in code unit order with default case folding.
  • U_COMPARE_CODE_POINT_ORDER Set to choose code point order instead of code unit order (see u_strCompare for details).
  • U_FOLD_CASE_EXCLUDE_SPECIAL_I
Returns:
A negative, zero, or positive integer indicating the comparison result.
Stable:

Definition at line 3334 of file unistr.h.

int8_t UnicodeString::caseCompare const UChar *    srcChars,
int32_t    srcLength,
uint32_t    options
const [inline]
 

Compare two strings case-insensitively using full case folding.

This is equivalent to this->foldCase(options).compare(srcChars.foldCase(options)).

Parameters:
srcChars  A pointer to another string to compare this one to.
srcLength  The number of code units from that string to compare.
options  A bit set of options:
  • U_FOLD_CASE_DEFAULT or 0 is used for default options: Comparison in code unit order with default case folding.
  • U_COMPARE_CODE_POINT_ORDER Set to choose code point order instead of code unit order (see u_strCompare for details).
  • U_FOLD_CASE_EXCLUDE_SPECIAL_I
Returns:
A negative, zero, or positive integer indicating the comparison result.
Stable:

Definition at line 3317 of file unistr.h.

int8_t UnicodeString::caseCompare int32_t    start,
int32_t    length,
const UnicodeString &    srcText,
int32_t    srcStart,
int32_t    srcLength,
uint32_t    options
const [inline]
 

Compare two strings case-insensitively using full case folding.

This is equivalent to this->foldCase(options).compare(srcText.foldCase(options)).

Parameters:
start  The start offset in this string at which the compare operation begins.
length  The number of code units from this string to compare.
srcText  Another string to compare this one to.
srcStart  The start offset in that string at which the compare operation begins.
srcLength  The number of code units from that string to compare.
options  A bit set of options:
  • U_FOLD_CASE_DEFAULT or 0 is used for default options: Comparison in code unit order with default case folding.
  • U_COMPARE_CODE_POINT_ORDER Set to choose code point order instead of code unit order (see u_strCompare for details).
  • U_FOLD_CASE_EXCLUDE_SPECIAL_I
Returns:
A negative, zero, or positive integer indicating the comparison result.
Stable:

Definition at line 3324 of file unistr.h.

int8_t UnicodeString::caseCompare int32_t    start,
int32_t    length,
const UnicodeString &    srcText,
uint32_t    options
const [inline]
 

Compare two strings case-insensitively using full case folding.

This is equivalent to this->foldCase(options).compare(srcText.foldCase(options)).

Parameters:
start  The start offset in this string at which the compare operation begins.
length  The number of code units from this string to compare.
srcText  Another string to compare this one to.
options  A bit set of options:
  • U_FOLD_CASE_DEFAULT or 0 is used for default options: Comparison in code unit order with default case folding.
  • U_COMPARE_CODE_POINT_ORDER Set to choose code point order instead of code unit order (see u_strCompare for details).
  • U_FOLD_CASE_EXCLUDE_SPECIAL_I
Returns:
A negative, zero, or positive integer indicating the comparison result.
Stable:

Definition at line 3309 of file unistr.h.

int8_t UnicodeString::caseCompare const UnicodeString &    text,
uint32_t    options
const [inline]
 

Compare two strings case-insensitively using full case folding.

This is equivalent to this->foldCase(options).compare(text.foldCase(options)).

Parameters:
text  Another string to compare this one to.
options  A bit set of options:
  • U_FOLD_CASE_DEFAULT or 0 is used for default options: Comparison in code unit order with default case folding.
  • U_COMPARE_CODE_POINT_ORDER Set to choose code point order instead of code unit order (see u_strCompare for details).
  • U_FOLD_CASE_EXCLUDE_SPECIAL_I
Returns:
A negative, zero, or positive integer indicating the comparison result.
Stable:

Definition at line 3304 of file unistr.h.

int8_t UnicodeString::caseCompareBetween int32_t    start,
int32_t    limit,
const UnicodeString &    srcText,
int32_t    srcStart,
int32_t    srcLimit,
uint32_t    options
const [inline]
 

Compare two strings case-insensitively using full case folding.

This is equivalent to this->foldCase(options).compareBetween(text.foldCase(options)).

Parameters:
start  The start offset in this string at which the compare operation begins.
limit  The offset after the last code unit from this string to compare.
srcText  Another string to compare this one to.
srcStart  The start offset in that string at which the compare operation begins.
srcLimit  The offset after the last code unit from that string to compare.
options  A bit set of options:
  • U_FOLD_CASE_DEFAULT or 0 is used for default options: Comparison in code unit order with default case folding.
  • U_COMPARE_CODE_POINT_ORDER Set to choose code point order instead of code unit order (see u_strCompare for details).
  • U_FOLD_CASE_EXCLUDE_SPECIAL_I
Returns:
A negative, zero, or positive integer indicating the comparison result.
Stable:

Definition at line 3352 of file unistr.h.

UnicodeString& UnicodeString::caseMap BreakIterator   titleIter,
const Locale   locale,
uint32_t    options,
int32_t    toWhichCase
[private]
 

UChar32 UnicodeString::char32At int32_t    offset const [inline]
 

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
Stable:

Reimplemented from Replaceable.

Definition at line 3721 of file unistr.h.

UChar UnicodeString::charAt int32_t    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
Stable:

Reimplemented from Replaceable.

Definition at line 3713 of file unistr.h.

Referenced by UCharReference::operator UChar(), and UCharReference::operator=().

UBool UnicodeString::cloneArrayIfNeeded int32_t    newCapacity = -1,
int32_t    growCapacity = -1,
UBool    doCopyArray = TRUE,
int32_t **    pBufferToDelete = 0,
UBool    forceClone = FALSE
[private]
 

Referenced by getTerminatedBuffer().

int8_t UnicodeString::compare int32_t    start,
int32_t    length,
const UChar *    srcChars,
int32_t    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 3207 of file unistr.h.

int8_t UnicodeString::compare int32_t    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 3201 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 3188 of file unistr.h.

int8_t UnicodeString::compare int32_t    start,
int32_t    length,
const UnicodeString &    srcText,
int32_t    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 3193 of file unistr.h.

int8_t UnicodeString::compare int32_t    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 3182 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 3178 of file unistr.h.

Referenced by startsWith().

int8_t UnicodeString::compareBetween int32_t    start,
int32_t    limit,
const UnicodeString &    srcText,
int32_t    srcStart,
int32_t    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 3215 of file unistr.h.

int8_t UnicodeString::compareCodePointOrder int32_t    start,
int32_t    length,
const UChar *    srcChars,
int32_t    srcStart,
int32_t    srcLength
const [inline]
 

Compare two Unicode strings in code point order.

This is different in UTF-16 from how compare(), operator==, startsWith() etc. work if supplementary characters are present:

In UTF-16, supplementary characters (with code points U+10000 and above) are stored with pairs of surrogate code units. These have values from 0xd800 to 0xdfff, which means that they compare as less than some other BMP characters like U+feff. This function compares Unicode strings in code point order. If either of the UTF-16 strings is malformed (i.e., it contains unpaired surrogates), then the result is not defined.

Parameters:
start  The start offset in this string at which the compare operation begins.
length  The number of code units from this string to compare.
srcChars  A pointer to another string to compare this one to.
srcStart  The start offset in that string at which the compare operation begins.
srcLength  The number of code units from that string to compare.
Returns:
a negative/zero/positive integer corresponding to whether this string is less than/equal to/greater than the second one in code point order
Stable:

Definition at line 3270 of file unistr.h.

int8_t UnicodeString::compareCodePointOrder int32_t    start,
int32_t    length,
const UChar *    srcChars
const [inline]
 

Compare two Unicode strings in code point order.

This is different in UTF-16 from how compare(), operator==, startsWith() etc. work if supplementary characters are present:

In UTF-16, supplementary characters (with code points U+10000 and above) are stored with pairs of surrogate code units. These have values from 0xd800 to 0xdfff, which means that they compare as less than some other BMP characters like U+feff. This function compares Unicode strings in code point order. If either of the UTF-16 strings is malformed (i.e., it contains unpaired surrogates), then the result is not defined.

Parameters:
start  The start offset in this string at which the compare operation begins.
length  The number of code units from this string to compare.
srcChars  A pointer to another string to compare this one to.
Returns:
a negative/zero/positive integer corresponding to whether this string is less than/equal to/greater than the second one in code point order
Stable:

Definition at line 3264 of file unistr.h.

int8_t UnicodeString::compareCodePointOrder const UChar *    srcChars,
int32_t    srcLength
const [inline]
 

Compare two Unicode strings in code point order.

This is different in UTF-16 from how compare(), operator==, startsWith() etc. work if supplementary characters are present:

In UTF-16, supplementary characters (with code points U+10000 and above) are stored with pairs of surrogate code units. These have values from 0xd800 to 0xdfff, which means that they compare as less than some other BMP characters like U+feff. This function compares Unicode strings in code point order. If either of the UTF-16 strings is malformed (i.e., it contains unpaired surrogates), then the result is not defined.

Parameters:
srcChars  A pointer to another string to compare this one to.
srcLength  The number of code units from that string to compare.
Returns:
a negative/zero/positive integer corresponding to whether this string is less than/equal to/greater than the second one in code point order
Stable:

Definition at line 3251 of file unistr.h.

int8_t UnicodeString::compareCodePointOrder int32_t    start,
int32_t    length,
const UnicodeString &    srcText,
int32_t    srcStart,
int32_t    srcLength
const [inline]
 

Compare two Unicode strings in code point order.

This is different in UTF-16 from how compare(), operator==, startsWith() etc. work if supplementary characters are present:

In UTF-16, supplementary characters (with code points U+10000 and above) are stored with pairs of surrogate code units. These have values from 0xd800 to 0xdfff, which means that they compare as less than some other BMP characters like U+feff. This function compares Unicode strings in code point order. If either of the UTF-16 strings is malformed (i.e., it contains unpaired surrogates), then the result is not defined.

Parameters:
start  The start offset in this string at which the compare operation begins.
length  The number of code units from this string to compare.
srcText  Another string to compare this one to.
srcStart  The start offset in that string at which the compare operation begins.
srcLength  The number of code units from that string to compare.
Returns:
a negative/zero/positive integer corresponding to whether this string is less than/equal to/greater than the second one in code point order
Stable:

Definition at line 3256 of file unistr.h.

int8_t UnicodeString::compareCodePointOrder int32_t    start,
int32_t    length,
const UnicodeString &    srcText
const [inline]
 

Compare two Unicode strings in code point order.

This is different in UTF-16 from how compare(), operator==, startsWith() etc. work if supplementary characters are present:

In UTF-16, supplementary characters (with code points U+10000 and above) are stored with pairs of surrogate code units. These have values from 0xd800 to 0xdfff, which means that they compare as less than some other BMP characters like U+feff. This function compares Unicode strings in code point order. If either of the UTF-16 strings is malformed (i.e., it contains unpaired surrogates), then the result is not defined.

Parameters:
start  The start offset in this string at which the compare operation begins.
length  The number of code units from this string to compare.
srcText  Another string to compare this one to.
Returns:
a negative/zero/positive integer corresponding to whether this string is less than/equal to/greater than the second one in code point order
Stable:

Definition at line 3245 of file unistr.h.

int8_t UnicodeString::compareCodePointOrder const UnicodeString &    text const [inline]
 

Compare two Unicode strings in code point order.

This is different in UTF-16 from how compare(), operator==, startsWith() etc. work if supplementary characters are present:

In UTF-16, supplementary characters (with code points U+10000 and above) are stored with pairs of surrogate code units. These have values from 0xd800 to 0xdfff, which means that they compare as less than some other BMP characters like U+feff. This function compares Unicode strings in code point order. If either of the UTF-16 strings is malformed (i.e., it contains unpaired surrogates), then the result is not defined.

Parameters:
text  Another string to compare this one to.
Returns:
a negative/zero/positive integer corresponding to whether this string is less than/equal to/greater than the second one in code point order
Stable:

Definition at line 3241 of file unistr.h.

int8_t UnicodeString::compareCodePointOrderBetween int32_t    start,
int32_t    limit,
const UnicodeString &    srcText,
int32_t    srcStart,
int32_t    srcLimit
const [inline]
 

Compare two Unicode strings in code point order.

This is different in UTF-16 from how compare(), operator==, startsWith() etc. work if supplementary characters are present:

In UTF-16, supplementary characters (with code points U+10000 and above) are stored with pairs of surrogate code units. These have values from 0xd800 to 0xdfff, which means that they compare as less than some other BMP characters like U+feff. This function compares Unicode strings in code point order. If either of the UTF-16 strings is malformed (i.e., it contains unpaired surrogates), then the result is not defined.

Parameters:
start  The start offset in this string at which the compare operation begins.
limit  The offset after the last code unit from this string to compare.
srcText  Another string to compare this one to.
srcStart  The start offset in that string at which the compare operation begins.
srcLimit  The offset after the last code unit from that string to compare.
Returns:
a negative/zero/positive integer corresponding to whether this string is less than/equal to/greater than the second one in code point order
Stable:

Definition at line 3278 of file unistr.h.

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.
Stable:

Reimplemented from Replaceable.

int32_t UnicodeString::countChar32 int32_t    start = 0,
int32_t    length = 0x7fffffff
const
 

Count Unicode code points in the length UChar code units of the string.

A code point may occupy either one or two UChar code units. Counting code points involves reading all code units.

This functions is basically the inverse of moveIndex32().

Parameters:
start  the index of the first code unit to check
length  the number of UChar code units to check
Returns:
the number of code points in the specified code units
Draft:
This API has been introduced in ICU 2.0. It is still in draft state and may be modified in a future release.

int8_t UnicodeString::doCaseCompare int32_t    start,
int32_t    length,
const UChar *    srcChars,
int32_t    srcStart,
int32_t    srcLength,
uint32_t    options
const [private]
 

int8_t UnicodeString::doCaseCompare int32_t    start,
int32_t    length,
const UnicodeString &    srcText,
int32_t    srcStart,
int32_t    srcLength,
uint32_t    options
const [inline, private]
 

Definition at line 3362 of file unistr.h.

Referenced by caseCompare(), and caseCompareBetween().

UChar UnicodeString::doCharAt int32_t    offset const [inline, private]
 

Definition at line 3703 of file unistr.h.

Referenced by charAt(), and operator[]().

void UnicodeString::doCodepageCreate const char *    codepageData,
int32_t    dataLength,
UConverter   converter,
UErrorCode   status
[private]
 

void UnicodeString::doCodepageCreate const char *    codepageData,
int32_t    dataLength,
const char *    codepage
[private]
 

int8_t UnicodeString::doCompare int32_t    start,
int32_t    length,
const UChar *    srcChars,
int32_t    srcStart,
int32_t    srcLength
const [private]
 

int8_t UnicodeString::doCompare int32_t    start,
int32_t    length,
const UnicodeString &    srcText,
int32_t    srcStart,
int32_t    srcLength
const [inline, private]
 

Definition at line 3224 of file unistr.h.

Referenced by compare(), compareBetween(), endsWith(), operator<(), operator<=(), operator==(), operator>(), operator>=(), and startsWith().

int8_t UnicodeString::doCompareCodePointOrder int32_t    start,
int32_t    length,
const UChar *    srcChars,
int32_t    srcStart,
int32_t    srcLength
const [private]
 

int8_t UnicodeString::doCompareCodePointOrder int32_t    start,
int32_t    length,
const UnicodeString &    srcText,
int32_t    srcStart,
int32_t    srcLength
const [inline, private]
 

Definition at line 3287 of file unistr.h.

Referenced by compareCodePointOrder(), and compareCodePointOrderBetween().

int32_t UnicodeString::doExtract int32_t    start,
int32_t    length,
char *    dest,
int32_t    destCapacity,
UConverter   cnv,
UErrorCode   errorCode
const [private]
 

void UnicodeString::doExtract int32_t    start,
int32_t    length,
UnicodeString &    target
const [inline, private]
 

Definition at line 3666 of file unistr.h.

void UnicodeString::doExtract int32_t    start,
int32_t    length,
UChar *    dst,
int32_t    dstStart
const [private]
 

Referenced by extract(), and extractBetween().

int32_t UnicodeString::doHashCode void    const [private]
 

Referenced by hashCode().

int32_t UnicodeString::doIndexOf UChar32    c,
int32_t    start,
int32_t    length
const [private]
 

int32_t UnicodeString::doIndexOf UChar    c,
int32_t    start,
int32_t    length
const [private]
 

Referenced by indexOf().

int32_t UnicodeString::doLastIndexOf UChar32    c,
int32_t    start,
int32_t    length
const [private]
 

int32_t UnicodeString::doLastIndexOf UChar    c,
int32_t    start,
int32_t    length
const [private]
 

Referenced by lastIndexOf().

UnicodeString& UnicodeString::doReplace int32_t    start,
int32_t    length,
const UChar *    srcChars,
int32_t    srcStart,
int32_t    srcLength
[private]
 

UnicodeString& UnicodeString::doReplace int32_t    start,
int32_t    length,
const UnicodeString &    srcText,
int32_t    srcStart,
int32_t    srcLength
[private]
 

Referenced by append(), insert(), operator+=(), operator=(), remove(), removeBetween(), replace(), replaceBetween(), and setTo().

UnicodeString& UnicodeString::doReverse int32_t    start,
int32_t    length
[private]
 

Referenced by reverse().

UBool UnicodeString::empty void    const [inline]
 

Determine if this string is empty.

This function was renamed to isEmtpy() because it caused confusion. If you need to determine if a string is empty, then use isEmpty(). If you want to remove a string's contents, then call truncate(0).

Returns:
TRUE if this string contains 0 characters, FALSE otherwise.
Deprecated:
To be removed after 2002-sep-30. Use isEmtpy() or truncate(0).

Definition at line 3768 of file unistr.h.

UBool UnicodeString::endsWith const UChar *    srcChars,
int32_t    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 3581 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 3575 of file unistr.h.

UBool UnicodeString::endsWith const UnicodeString &    srcText,
int32_t    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 3568 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 3563 of file unistr.h.

int32_t UnicodeString::extract char *    dest,
int32_t    destCapacity,
UConverter   cnv,
UErrorCode   errorCode
const
 

Convert the UnicodeString into a codepage string using an existing UConverter.

The output string is NUL-terminated if possible.

This function avoids the overhead of opening and closing a converter if multiple strings are extracted.

Parameters:
dest  destination string buffer, can be NULL if destCapacity==0
destCapacity  the number of chars available at dest
cnv  the converter object to be used (ucnv_resetFromUnicode() will be called), or NULL for the default converter
errorCode  normal ICU error code
Returns:
the length of the output string, not counting the terminating NUL; if the length is greater than destCapacity, then the string will not fit and a buffer of the indicated length would need to be passed in
Draft:
This API has been introduced in ICU 2.0. It is still in draft state and may be modified in a future release.

int32_t UnicodeString::extract int32_t    start,
int32_t    startLength,
char *    target,
uint32_t    targetLength,
const char *    codepage = 0
const
 

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

This function does not write any more than targetLength characters but returns the length of the entire output string so that one can allocate a larger buffer and call the function again if necessary. The output string is NUL-terminated if possible.

Parameters:
start  offset of first character which will be copied
startLength  the number of characters to extract
target  the target buffer for extraction
targetLength  the length of the target buffer
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. If target is NULL, then the number of bytes required for target is returned.
Returns:
the output string length, not including the terminating NUL
Stable:

int32_t UnicodeString::extract int32_t    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.

The output string is NUL-terminated.

Parameters:
start  offset of first character which will be copied
startLength  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. If target is NULL, then the number of bytes required for target is returned. It is assumed that the target is big enough to fit all of the characters.
Returns:
the output string length, not including the terminating NUL
Stable:

Definition at line 3685 of file unistr.h.

void UnicodeString::extract int32_t    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 3679 of file unistr.h.

int32_t UnicodeString::extract UChar *    dest,
int32_t    destCapacity,
UErrorCode   errorCode
const
 

Copy the contents of the string into dest.

This is a convenience function that checks if there is enough space in dest, extracts the entire string if possible, and NUL-terminates dest if possible.

If the string fits into dest but cannot be NUL-terminated (length()==destCapacity) then the error code is set to U_STRING_NOT_TERMINATED_WARNING. If the string itself does not fit into dest (length()>destCapacity) then the error code is set to U_BUFFER_OVERFLOW_ERROR.

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

Parameters:
dest  Destination string buffer.
destCapacity  Number of UChars available at dest.
errorCode  ICU error code.
Returns:
length()
Draft:
This API has been introduced in ICU 2.0. It is still in draft state and may be modified in a future release.

void UnicodeString::extract int32_t    start,
int32_t    length,
UChar *    target,
int32_t    targetStart = 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:

Definition at line 3672 of file unistr.h.

Referenced by extract(), and Format::syntaxError().

virtual void UnicodeString::extractBetween int32_t    start,
int32_t    limit,
UnicodeString &    target
const [virtual]
 

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

Replaceable API.

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:

Reimplemented from Replaceable.

void UnicodeString::extractBetween int32_t    start,
int32_t    limit,
UChar *    dst,
int32_t    dstStart = 0
const [inline]
 

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:

Definition at line 3696 of file unistr.h.

UnicodeString& UnicodeString::findAndReplace int32_t    start,
int32_t    length,
const UnicodeString &    oldText,
int32_t    oldStart,
int32_t    oldLength,
const UnicodeString &    newText,
int32_t    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::findAndReplace int32_t    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 3655 of file unistr.h.

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 3649 of file unistr.h.

Referenced by findAndReplace().

UnicodeString& UnicodeString::foldCase uint32_t    options = 0
 

Case-fold the characters in this string.

Case-folding is locale-independent and not context-sensitive, but there is an option for whether to include or exclude mappings for dotted I and dotless i that are marked with 'I' in CaseFolding.txt. The result may be longer or shorter than the original.

Parameters:
options  Either U_FOLD_CASE_DEFAULT or U_FOLD_CASE_EXCLUDE_SPECIAL_I
Returns:
A reference to this.
Stable:

const UChar* UnicodeString::getArrayStart void    const [inline, private]
 

const UChar * UnicodeString::getArrayStart void    [inline, private]
 

Definition at line 3995 of file unistr.h.

Referenced by doCaseCompare(), doCompare(), doCompareCodePointOrder(), indexOf(), and lastIndexOf().

const UChar * UnicodeString::getBuffer   const [inline]
 

Get a read-only pointer to the internal buffer.

This can be called at any time on a valid UnicodeString.

It returns 0 if the string is bogus, or during an "open" getBuffer(minCapacity).

It can be called as many times as desired. The pointer that it returns will remain valid until the UnicodeString object is modified, at which time the pointer is semantically invalidated and must not be used any more.

The capacity of the buffer can be determined with getCapacity(). The part after length() may or may not be initialized and valid, depending on the history of the UnicodeString object.

The buffer contents is (probably) not NUL-terminated. You can check if it is with (s.length()<s.getCapacity() && buffer[s.length()]==0). (See getTerminatedBuffer().)

The buffer may reside in read-only memory. Its contents must not be modified.

Returns:
a read-only pointer to the internal string buffer, or 0 if the string is empty or bogus
See also:
getBuffer(int32_t minCapacity) , getTerminatedBuffer()
Draft:
This API has been introduced in ICU 2.0. It is still in draft state and may be modified in a future release.

Definition at line 3792 of file unistr.h.

Referenced by Normalizer::compare(), Normalizer::isNormalized(), ICULayoutEngine::layoutString(), and Normalizer::quickCheck().

UChar* UnicodeString::getBuffer int32_t    minCapacity
 

Get a read/write pointer to the internal buffer.

The buffer is guaranteed to be large enough for at least minCapacity UChars, writable, and is still owned by the UnicodeString object. Calls to getBuffer(minCapacity) must not be nested, and must be matched with calls to releaseBuffer(newLength). If the string buffer was read-only or shared, then it will be reallocated and copied.

An attempted nested call will return 0, and will not further modify the state of the UnicodeString object.

The actual capacity of the string buffer may be larger than minCapacity. getCapacity() returns the actual capacity. For many operations, the full capacity should be used to avoid reallocations.

While the buffer is "open" between getBuffer(minCapacity) and releaseBuffer(newLength), the following applies:

  • The string length is set to 0.
  • Any read API call on the UnicodeString object will behave like on a 0-length string.
  • Any write API call on the UnicodeString object is disallowed and will have no effect.
  • You can read from and write to the returned buffer.
  • The previous string contents will still be in the buffer; if you want to use it, then you need to call length() before getBuffer(minCapacity). If the length() was greater than minCapacity, then any contents after minCapacity may be lost. The buffer contents is not NUL-terminated by getBuffer(). If length()<getCapacity() then you can terminate it by writing a NUL at index length().
  • You must call releaseBuffer(newLength) before and in order to return to normal UnicodeString operation.
Parameters:
minCapacity  the minimum number of UChars that are to be available in the buffer, starting at the returned pointer; default to the current string capacity if minCapacity==-1
Returns:
a writable pointer to the internal string buffer, or 0 if an error occurs (nested calls, out of memory)
See also:
releaseBuffer , getTerminatedBuffer()
Draft:
This API has been introduced in ICU 2.0. It is still in draft state and may be modified in a future release.

int32_t UnicodeString::getCapacity void    const [inline]
 

Return the capacity of the internal buffer of the UnicodeString object.

This is useful together with the getBuffer functions. See there for details.

Returns:
the number of UChars available in the internal buffer
See also:
getBuffer
Draft:
This API has been introduced in ICU 2.0 (was private before). It is still in draft state and may be modified in a future release.

Definition at line 3780 of file unistr.h.

virtual UChar32 UnicodeString::getChar32At int32_t    offset const [protected, virtual]
 

The change in Replaceable to use virtual getChar32At() allows UnicodeString::char32At() to be inline again (see jitterbug 709).

Reimplemented from Replaceable.

int32_t UnicodeString::getChar32Limit int32_t    offset const [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
Draft:
This API has been introduced in ICU 2.0. It is still in draft state and may be modified in a future release.

Definition at line 3743 of file unistr.h.

Referenced by getCharLimit().

int32_t UnicodeString::getChar32Start int32_t    offset const [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
Draft:
This API has been introduced in ICU 2.0. It is still in draft state and may be modified in a future release.

Definition at line 3733 of file unistr.h.

Referenced by getCharStart().

virtual UChar UnicodeString::getCharAt int32_t    offset const [protected, virtual]
 

The change in Replaceable to use virtual getCharAt() allows UnicodeString::charAt() to be inline again (see jitterbug 709).

Reimplemented from Replaceable.

int32_t UnicodeString::getCharLimit int32_t    offset const [inline]
 

Same as getChar32Limit().

This original function name (without "32") was meant to look like UTF_SET_CHAR_LIMIT, but since most code point-related function names in C++ APIs contain a "32", this caused confusion.

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
Deprecated:
To be removed after 2002-sep-30. Use getChar32Limit().

Definition at line 3758 of file unistr.h.

int32_t UnicodeString::getCharStart int32_t    offset const [inline]
 

Same as getChar32Start().

This original function name (without "32") was meant to look like UTF_SET_CHAR_START, but since most code point-related function names in C++ APIs contain a "32", this caused confusion.

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
Deprecated:
To be removed after 2002-sep-30. Use getChar32Start().

Definition at line 3753 of file unistr.h.

virtual UClassID UnicodeString::getDynamicClassID void    const [inline, virtual]
 

ICU "poor man's RTTI", returns a UClassID for the actual class.

Draft:
This API has been introduced in ICU 2.2. It is still in draft state and may be modified in a future release.

Reimplemented from UObject.

Definition at line 2861 of file unistr.h.

virtual int32_t UnicodeString::getLength void    const [protected, virtual]
 

Implement Replaceable::getLength() (see jitterbug 1027).

Reimplemented from Replaceable.

UClassID UnicodeString::getStaticClassID void    [inline, static]
 

ICU "poor man's RTTI", returns a UClassID for this class.

Draft:
This API has been introduced in ICU 2.2. It is still in draft state and may be modified in a future release.

Definition at line 2868 of file unistr.h.

const UChar * UnicodeString::getTerminatedBuffer   [inline]
 

Get a read-only pointer to the internal buffer, making sure that it is NUL-terminated.

This can be called at any time on a valid UnicodeString.

It returns 0 if the string is bogus, or during an "open" getBuffer(minCapacity), or if the buffer cannot be NUL-terminated (because memory allocation failed).

It can be called as many times as desired. The pointer that it returns will remain valid until the UnicodeString object is modified, at which time the pointer is semantically invalidated and must not be used any more.

The capacity of the buffer can be determined with getCapacity(). The part after length()+1 may or may not be initialized and valid, depending on the history of the UnicodeString object.

The buffer contents is guaranteed to be NUL-terminated. getTerminatedBuffer() may reallocate the buffer if a terminating NUL is written. For this reason, this function is not const, unlike getBuffer(). Note that a UnicodeString may also contain NUL characters as part of its contents.

The buffer may reside in read-only memory. Its contents must not be modified.

Returns:
a read-only pointer to the internal string buffer, or 0 if the string is empty or bogus
See also:
getBuffer(int32_t minCapacity) , getBuffer()
Draft:
This API has been introduced in ICU 2.2. It is still in draft state and may be modified in a future release.

Definition at line 3804 of file unistr.h.

virtual void UnicodeString::handleReplaceBetween int32_t    start,
int32_t    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 UBool UnicodeString::hasMetaData   const [virtual]
 

Replaceable API.

Returns:
TRUE if it has MetaData

Reimplemented from Replaceable.

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 3784 of file unistr.h.

int32_t UnicodeString::indexOf UChar32    c,
int32_t    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.

This function finds code points, which differs for BMP code points from indexOf(UChar c, ...) only for surrogates: While indexOf(UChar c, ...) finds any surrogate code units in a string, indexOf(UChar32 c, ...) finds only unmatched surrogate code points, i.e., only those that do not combine with an adjacent surrogate to form a supplementary code point. For example, in a string "\ud800\udc00" indexOf(UChar c, ...) will find code units U+d800 at 0 and U+dc00 at 1, but indexOf(UChar32 c, ...) will find neither because they combine to the code point U+10000. Either function will find U+d800 in "a\ud800b". This behavior ensures that char32At(indexOf(UChar32 c))==c.

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.
Stable:

Definition at line 3450 of file unistr.h.

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

Locate in this the first occurrence of the code unit 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.
Stable:

Definition at line 3444 of file unistr.h.

int32_t UnicodeString::indexOf UChar32    c,
int32_t    start
const [inline]
 

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

This function finds code points, which differs for BMP code points from indexOf(UChar c, ...) only for surrogates: While indexOf(UChar c, ...) finds any surrogate code units in a string, indexOf(UChar32 c, ...) finds only unmatched surrogate code points, i.e., only those that do not combine with an adjacent surrogate to form a supplementary code point. For example, in a string "\ud800\udc00" indexOf(UChar c, ...) will find code units U+d800 at 0 and U+dc00 at 1, but indexOf(UChar32 c, ...) will find neither because they combine to the code point U+10000. Either function will find U+d800 in "a\ud800b". This behavior ensures that char32At(indexOf(UChar32 c))==c.

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.
Stable:

Definition at line 3438 of file unistr.h.

int32_t UnicodeString::indexOf UChar    c,
int32_t    start
const [inline]
 

Locate in this the first occurrence of the code unit 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.
Stable:

Definition at line 3433 of file unistr.h.

int32_t UnicodeString::indexOf UChar32    c const [inline]
 

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

This function finds code points, which differs for BMP code points from indexOf(UChar c, ...) only for surrogates: While indexOf(UChar c, ...) finds any surrogate code units in a string, indexOf(UChar32 c, ...) finds only unmatched surrogate code points, i.e., only those that do not combine with an adjacent surrogate to form a supplementary code point. For example, in a string "\ud800\udc00" indexOf(UChar c, ...) will find code units U+d800 at 0 and U+dc00 at 1, but indexOf(UChar32 c, ...) will find neither because they combine to the code point U+10000. Either function will find U+d800 in "a\ud800b". This behavior ensures that char32At(indexOf(UChar32 c))==c.

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

Definition at line 3428 of file unistr.h.

int32_t UnicodeString::indexOf UChar    c const [inline]
 

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

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

Definition at line 3424 of file unistr.h.

int32_t UnicodeString::indexOf const UChar *    srcChars,
int32_t    srcStart,
int32_t    srcLength,
int32_t    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:

int32_t UnicodeString::indexOf const UChar *    srcChars,
int32_t    srcLength,
int32_t    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 3417 of file unistr.h.

int32_t UnicodeString::indexOf const UChar *    srcChars,
int32_t    srcLength,
int32_t    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 3411 of file unistr.h.

int32_t UnicodeString::indexOf const UnicodeString &    srcText,
int32_t    srcStart,
int32_t    srcLength,
int32_t    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 3395 of file unistr.h.

int32_t UnicodeString::indexOf const UnicodeString &    text,
int32_t    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 3389 of file unistr.h.

int32_t UnicodeString::indexOf const UnicodeString &    text,
int32_t    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 3384 of file unistr.h.

int32_t 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 3380 of file unistr.h.

Referenced by indexOf().

UnicodeString & UnicodeString::insert int32_t    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
Stable:

Definition at line 3933 of file unistr.h.

UnicodeString & UnicodeString::insert int32_t    start,
UChar    srcChar
[inline]
 

Insert the code unit 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
Stable:

Definition at line 3928 of file unistr.h.

UnicodeString & UnicodeString::insert int32_t    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 3922 of file unistr.h.

UnicodeString & UnicodeString::insert int32_t    start,
const UChar *    srcChars,
int32_t    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 3915 of file unistr.h.

UnicodeString & UnicodeString::insert int32_t    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 3910 of file unistr.h.

UnicodeString & UnicodeString::insert int32_t    start,
const UnicodeString &    srcText,
int32_t    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 3903 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
See also:
setToBogus()
Draft:
This API has been introduced in ICU 2.0 (was private before). It is still in draft state and may be modified in a future release.

Definition at line 3788 of file unistr.h.

Referenced by doCaseCompare(), doCompare(), doCompareCodePointOrder(), indexOf(), lastIndexOf(), and operator==().

UBool UnicodeString::isEmpty void    const [inline]
 

Determine if this string is empty.

Returns:
TRUE if this string contains 0 characters, FALSE otherwise.
Draft:
This API has been introduced in ICU 2.0. It is still in draft state and may be modified in a future release.

Definition at line 3763 of file unistr.h.

Referenced by empty().

int32_t UnicodeString::lastIndexOf UChar32    c,
int32_t    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.

This function finds code points, which differs for BMP code points from lastIndexOf(UChar c, ...) only for surrogates: While lastIndexOf(UChar c, ...) finds any surrogate code units in a string, lastIndexOf(UChar32 c, ...) finds only unmatched surrogate code points, i.e., only those that do not combine with an adjacent surrogate to form a supplementary code point. For example, in a string "\ud800\udc00" lastIndexOf(UChar c, ...) will find code units U+d800 at 0 and U+dc00 at 1, but lastIndexOf(UChar32 c, ...) will find neither because they combine to the code point U+10000. Either function will find U+d800 in "a\ud800b". This behavior ensures that char32At(lastIndexOf(UChar32 c))==c.

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.
Stable:

Definition at line 3531 of file unistr.h.

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

Locate in this the last occurrence of the code unit 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.
Stable:

Definition at line 3525 of file unistr.h.

int32_t UnicodeString::lastIndexOf UChar32    c,
int32_t    start
const [inline]
 

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

This function finds code points, which differs for BMP code points from lastIndexOf(UChar c, ...) only for surrogates: While lastIndexOf(UChar c, ...) finds any surrogate code units in a string, lastIndexOf(UChar32 c, ...) finds only unmatched surrogate code points, i.e., only those that do not combine with an adjacent surrogate to form a supplementary code point. For example, in a string "\ud800\udc00" lastIndexOf(UChar c, ...) will find code units U+d800 at 0 and U+dc00 at 1, but lastIndexOf(UChar32 c, ...) will find neither because they combine to the code point U+10000. Either function will find U+d800 in "a\ud800b". This behavior ensures that char32At(lastIndexOf(UChar32 c))==c.

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.
Stable:

Definition at line 3519 of file unistr.h.

int32_t UnicodeString::lastIndexOf UChar    c,
int32_t    start
const [inline]
 

Locate in this the last occurrence of the code unit 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.
Stable:

Definition at line 3514 of file unistr.h.

int32_t UnicodeString::lastIndexOf UChar32    c const [inline]
 

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

This function finds code points, which differs for BMP code points from lastIndexOf(UChar c, ...) only for surrogates: While lastIndexOf(UChar c, ...) finds any surrogate code units in a string, lastIndexOf(UChar32 c, ...) finds only unmatched surrogate code points, i.e., only those that do not combine with an adjacent surrogate to form a supplementary code point. For example, in a string "\ud800\udc00" lastIndexOf(UChar c, ...) will find code units U+d800 at 0 and U+dc00 at 1, but lastIndexOf(UChar32 c, ...) will find neither because they combine to the code point U+10000. Either function will find U+d800 in "a\ud800b". This behavior ensures that char32At(lastIndexOf(UChar32 c))==c.

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

Definition at line 3509 of file unistr.h.

int32_t UnicodeString::lastIndexOf UChar    c const [inline]
 

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

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

Definition at line 3505 of file unistr.h.

int32_t UnicodeString::lastIndexOf const UChar *    srcChars,
int32_t    srcStart,
int32_t    srcLength,
int32_t    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:

int32_t UnicodeString::lastIndexOf const UChar *    srcChars,
int32_t    srcLength,
int32_t    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 3498 of file unistr.h.

int32_t UnicodeString::lastIndexOf const UChar *    srcChars,
int32_t    srcLength,
int32_t    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 3492 of file unistr.h.

int32_t UnicodeString::lastIndexOf const UnicodeString &    srcText,
int32_t    srcStart,
int32_t    srcLength,
int32_t    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:
srcText  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 3476 of file unistr.h.

int32_t UnicodeString::lastIndexOf const UnicodeString &    text,
int32_t    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 3470 of file unistr.h.

int32_t UnicodeString::lastIndexOf const UnicodeString &    text,
int32_t    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 3465 of file unistr.h.

int32_t 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 3461 of file unistr.h.

Referenced by lastIndexOf().

int32_t UnicodeString::length void    const [inline]
 

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 3776 of file unistr.h.

Referenced by Normalizer::compare(), Normalizer::isNormalized(), ICULayoutEngine::layoutString(), Normalizer::quickCheck(), and Format::syntaxError().

int32_t UnicodeString::moveIndex32 int32_t    index,
int32_t    delta
const
 

Move the code unit index along the string by delta code points.

Interpret the input index as a code unit-based offset into the string, move the index forward or backward by delta code points, and return the resulting index. The input index should point to the first code unit of a code point, if there is more than one.

Both input and output indexes are code unit-based as for all string indexes/offsets in ICU (and other libraries, like MBCS char*). If delta<0 then the index is moved backward (toward the start of the string). If delta>0 then the index is moved forward (toward the end of the string).

This behaves like CharacterIterator::move32(delta, kCurrent).

Examples:

 // s has code points 'a' U+10000 'b' U+10ffff U+2029
 UnicodeString s=UNICODE_STRING("a\U00010000b\U0010ffff\u2029", 31).unescape();

 // initial index: position of U+10000
 int32_t index=1;

 // the following examples will all result in index==4, position of U+10ffff

 // skip 2 code points from some position in the string
 index=s.moveIndex32(index, 2); // skips U+10000 and 'b'

 // go to the 3rd code point from the start of s (0-based)
 index=s.moveIndex32(0, 3); // skips 'a', U+10000, and 'b'

 // go to the next-to-last code point of s
 index=s.moveIndex32(s.length(), -2); // backward-skips U+2029 and U+10ffff
 
Parameters:
index  input code unit index
delta  (signed) code point count to move the index forward or backward in the string
Returns:
the resulting code unit index
Draft:
This API has been introduced in ICU 2.0. It is still in draft state and may be modified in a future release.

int32_t UnicodeString::numDisplayCells int32_t    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.
Deprecated:
To be removed after 2003-jun-30; use UCHAR_EAST_ASIAN_WIDTH.

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 3158 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 3866 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
Stable:

Definition at line 3858 of file unistr.h.

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
Stable:

Definition at line 3854 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 3166 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 3174 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
Stable:

Definition at line 3822 of file unistr.h.

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
Stable:

Definition at line 3818 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:

U_NAMESPACE_BEGIN 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 3145 of file unistr.h.

Referenced by operator!=().

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 3162 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 3170 of file unistr.h.

UCharReference UnicodeString::operator[] int32_t    pos
 

Return a modifiable reference to a code unit of the string.

Parameters:
pos  The index of the code unit to refer to.
Returns:
A modifiable UCharReference to that code unit.
Stable:

UChar UnicodeString::operator[] int32_t    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
Stable:

Definition at line 3717 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.
Stable:

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.
Stable:

void UnicodeString::pinIndices int32_t   start,
int32_t   length
const [inline, private]
 

Definition at line 3978 of file unistr.h.

Referenced by doCaseCompare(), doCompare(), doCompareCodePointOrder(), indexOf(), and lastIndexOf().

int32_t UnicodeString::refCount void    const [private]
 

void UnicodeString::releaseArray void    [private]
 

void UnicodeString::releaseBuffer int32_t    newLength = -1
 

Release a read/write buffer on a UnicodeString object with an "open" getBuffer(minCapacity).

This function must be called in a matched pair with getBuffer(minCapacity). releaseBuffer(newLength) must be called if and only if a getBuffer(minCapacity) is "open".

It will set the string length to newLength, at most to the current capacity. If newLength==-1 then it will set the length according to the first NUL in the buffer, or to the capacity if there is no NUL.

After calling releaseBuffer(newLength) the UnicodeString is back to normal operation.

Parameters:
newLength  the new length of the UnicodeString object; defaults to the current capacity if newLength is greater than that; if newLength==-1, it defaults to u_strlen(buffer) but not more than the current capacity of the string
See also:
getBuffer(int32_t minCapacity)
Draft:
This API has been introduced in ICU 2.0. It is still in draft state and may be modified in a future release.

UnicodeString & UnicodeString::remove int32_t    start,
int32_t    length = (int32_t)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 3939 of file unistr.h.

UnicodeString & UnicodeString::remove void    [inline]
 

Remove all characters from the UnicodeString object.

Returns:
a reference to this
Stable:

Definition at line 3944 of file unistr.h.

UnicodeString & UnicodeString::removeBetween int32_t    start,
int32_t    limit = (int32_t)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 3948 of file unistr.h.

int32_t UnicodeString::removeRef void    [private]
 

UnicodeString & UnicodeString::replace int32_t    start,
int32_t    length,
UChar32    srcChar
[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
Stable:

Definition at line 3625 of file unistr.h.

UnicodeString & UnicodeString::replace int32_t    start,
int32_t    length,
UChar    srcChar
[inline]
 

Replace the characters in the range [start, start + length) with the code unit 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 unit
Returns:
a reference to this
Stable:

Definition at line 3619 of file unistr.h.

UnicodeString & UnicodeString::replace int32_t    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 3604 of file unistr.h.

UnicodeString & UnicodeString::replace int32_t    start,
int32_t    length,
const UChar *    srcChars,
int32_t    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 3611 of file unistr.h.

UnicodeString & UnicodeString::replace int32_t    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 3590 of file unistr.h.

UnicodeString & UnicodeString::replace int32_t    start,
int32_t    length,
const UnicodeString &    srcText,
int32_t    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 3596 of file unistr.h.

Referenced by doExtract(), insert(), operator=(), and setTo().

UnicodeString & UnicodeString::replaceBetween int32_t    start,
int32_t    limit,
const UnicodeString &    srcText,
int32_t    srcStart,
int32_t    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 3641 of file unistr.h.

UnicodeString & UnicodeString::replaceBetween int32_t    start,
int32_t    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 3635 of file unistr.h.

UnicodeString & UnicodeString::reverse int32_t    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 3968 of file unistr.h.

UnicodeString & UnicodeString::reverse void    [inline]
 

Reverse this UnicodeString in place.

Returns:
a reference to this
Stable:

Definition at line 3964 of file unistr.h.

UnicodeString& UnicodeString::setCharAt int32_t    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
Stable:

Referenced by UCharReference::operator=().

int32_t UnicodeString::setRefCount int32_t    count [private]
 

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

Aliasing setTo() function, analogous to the writable-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.
Returns:
a reference to this
Stable:

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().
Returns:
a reference to this
Stable:

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
Stable:

Definition at line 3850 of file unistr.h.

UnicodeString & UnicodeString::setTo UChar    srcChar [inline]
 

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

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

Definition at line 3846 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 3841 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 3837 of file unistr.h.

UnicodeString & UnicodeString::setTo const UnicodeString &    srcText,
int32_t    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 3826 of file unistr.h.

UnicodeString & UnicodeString::setTo const UnicodeString &    srcText,
int32_t    srcStart
[inline]
 

Set the text in the UnicodeString object to the characters in srcText in the range [srcStart, srcText.length()).

srcText is not modified.

Parameters:
srcText  the source for the new characters
srcStart  the offset into srcText where new characters will be obtained
Returns:
a reference to this
Draft:
This API has been introduced in ICU2.2. It is still in draft state and may be modified in a future release.

Definition at line 3832 of file unistr.h.

void UnicodeString::setToBogus void   
 

Make this UnicodeString object invalid.

The string will test TRUE with isBogus().

This is used to indicate that an operation failed, and that the result string is "bogus" - which can be tested with isBogus(). This utility function is used throughout the UnicodeString implementation, and may be used in other functions, especially but not exclusively when such functions do not take a UErrorCode for simplicity.

A "bogus" string is essentially empty, and getBuffer() const will return 0.

The string object can be "revived" by assigning (operator=) another string, or by using one of the other setToXYZ functions, or simply by modifying it (which will work like with an empty string).

See also:
isBogus()
Draft:
This API has been introduced in ICU 2.0 (was private in earlier releases). It is still in draft state and may be modified in a future release.

UBool UnicodeString::startsWith const UChar *    srcChars,
int32_t    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 3557 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 3552 of file unistr.h.

UBool UnicodeString::startsWith const UnicodeString &    srcText,
int32_t    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 3546 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 3542 of file unistr.h.

UnicodeString& UnicodeString::toLower const Locale   locale
 

Convert the characters in this to lower 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 lower case following the conventions of the default locale.

Returns:
A reference to this.
Stable:

UnicodeString& UnicodeString::toTitle BreakIterator   titleIter,
const Locale   locale
 

Titlecase this string.

Casing is locale-dependent and context-sensitive. Titlecasing uses a break iterator to find the first characters of words that are to be titlecased. It titlecases those characters and lowercases all others.

The titlecase break iterator can be provided to customize for arbitrary styles, using rules and dictionaries beyond the standard iterators. It may be more efficient to always provide an iterator to avoid opening and closing one for each string. The standard titlecase iterator for the root locale implements the algorithm of Unicode TR 21.

This function uses only the first() and next() methods of the provided break iterator.

Parameters:
titleIter  A break iterator to find the first characters of words that are to be titlecased. If none is provided (0), then a standard titlecase break iterator is opened.
locale  The locale to consider.
Returns:
A reference to this.
Draft:
This API has been introduced in ICU 2.1. It is still in draft state and may be modified in a future release.

UnicodeString& UnicodeString::toTitle BreakIterator   titleIter
 

Titlecase this string, convenience function using the default locale.

Casing is locale-dependent and context-sensitive. Titlecasing uses a break iterator to find the first characters of words that are to be titlecased. It titlecases those characters and lowercases all others.

The titlecase break iterator can be provided to customize for arbitrary styles, using rules and dictionaries beyond the standard iterators. It may be more efficient to always provide an iterator to avoid opening and closing one for each string. The standard titlecase iterator for the root locale implements the algorithm of Unicode TR 21.

This function uses only the first() and next() methods of the provided break iterator.

Parameters:
titleIter  A break iterator to find the first characters of words that are to be titlecased. If none is provided (0), then a standard titlecase break iterator is opened.
Returns:
A reference to this.
Draft:
This API has been introduced in ICU 2.1. It is still in draft state and may be modified in a future release.

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::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::trim void   
 

Trims leading and trailing whitespace from this UnicodeString.

Returns:
a reference to this
Stable:

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 3953 of file unistr.h.

UnicodeString UnicodeString::unescape   const
 

Unescape a string of characters and return a string containing the result.

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,
=> U+000A, \v => U+000B, \f => U+000C, \r => U+000D, \" => U+0022, \' => U+0027, \? => U+003F, \ => U+005C

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.

This function is similar to u_unescape() but not identical to it. The latter takes a source char*, so it does escape recognition and also invariant conversion.

Returns:
a string with backslash escapes interpreted, or an empty string on error.
See also:
UnicodeString::unescapeAt() , u_unescape() , u_unescapeAt()
Stable:

UChar32 UnicodeString::unescapeAt int32_t   offset const
 

Unescape a single escape sequence and return the represented character.

See unescape() for a listing of the recognized escape sequences. The character at offset-1 is assumed (without checking) to be a backslash. If the escape sequence is ill-formed, or the offset is out of range, (UChar32)0xFFFFFFFF is returned.

Parameters:
offset  an input output parameter. On input, it is the offset into this string where the escape sequence is located, after the initial backslash. On output, it is advanced after the last character parsed. On error, it is not advanced at all.
Returns:
the character represented by the escape sequence at offset, or (UChar32)0xFFFFFFFF on error.
See also:
UnicodeString::unescape() , u_unescape() , u_unescapeAt()
Stable:


Friends And Related Function Documentation

friend class StringCharacterIterator [friend]
 

Definition at line 3090 of file unistr.h.

friend class StringThreadTest [friend]
 

Definition at line 3091 of file unistr.h.

friend class UnicodeConverter [friend]
 

Definition at line 3088 of file unistr.h.


Member Data Documentation

UChar* UnicodeString::fArray [private]
 

Definition at line 3107 of file unistr.h.

int32_t UnicodeString::fCapacity [private]
 

Definition at line 3106 of file unistr.h.

uint16_t UnicodeString::fFlags [private]
 

Definition at line 3108 of file unistr.h.

int32_t UnicodeString::fLength [private]
 

Definition at line 3105 of file unistr.h.

Referenced by append(), caseCompare(), compare(), compareCodePointOrder(), doExtract(), endsWith(), findAndReplace(), indexOf(), insert(), lastIndexOf(), operator+=(), operator<(), operator<=(), operator==(), operator>(), operator>=(), replace(), replaceBetween(), setTo(), and startsWith().

UChar UnicodeString::fStackBuffer[ US_STACKBUF_SIZE ] [private]
 

Definition at line 3112 of file unistr.h.

const char UnicodeString::fgClassID [static, private]
 

The address of this static class variable serves as this class's ID for ICU "poor man's RTTI".

Definition at line 3118 of file unistr.h.


The documentation for this class was generated from the following file:
Generated on Thu Aug 15 14:14:19 2002 for ICU 2.2 by doxygen1.2.11.1 written by Dimitri van Heesch, © 1997-2001