46u_strlen(
const UChar *s);
51#if !UCONFIG_NO_BREAK_ITERATION
70 char16_t *dest, int32_t destCapacity,
71 const char16_t *src, int32_t srcLength,
78class StringCharacterIterator;
79class UnicodeStringAppendable;
93#define US_INV icu::UnicodeString::kInvariant
112#if !U_CHAR16_IS_TYPEDEF
113# define UNICODE_STRING(cs, _length) icu::UnicodeString(TRUE, u ## cs, _length)
115# define UNICODE_STRING(cs, _length) icu::UnicodeString(TRUE, (const char16_t*)u ## cs, _length)
131#define UNICODE_STRING_SIMPLE(cs) UNICODE_STRING(cs, -1)
140#ifndef UNISTR_FROM_CHAR_EXPLICIT
141# if defined(U_COMBINED_IMPLEMENTATION) || defined(U_COMMON_IMPLEMENTATION) || defined(U_I18N_IMPLEMENTATION) || defined(U_IO_IMPLEMENTATION)
143# define UNISTR_FROM_CHAR_EXPLICIT explicit
146# define UNISTR_FROM_CHAR_EXPLICIT
160#ifndef UNISTR_FROM_STRING_EXPLICIT
161# if defined(U_COMBINED_IMPLEMENTATION) || defined(U_COMMON_IMPLEMENTATION) || defined(U_I18N_IMPLEMENTATION) || defined(U_IO_IMPLEMENTATION)
163# define UNISTR_FROM_STRING_EXPLICIT explicit
166# define UNISTR_FROM_STRING_EXPLICIT
203#ifndef UNISTR_OBJECT_SIZE
204# define UNISTR_OBJECT_SIZE 64
394 inline int8_t compare(int32_t start,
415 inline int8_t compare(int32_t start,
450 inline int8_t compare(int32_t start,
471 inline int8_t compare(int32_t start,
494 inline int8_t compareBetween(int32_t start,
517 inline int8_t compareCodePointOrder(
const UnicodeString& text)
const;
538 inline int8_t compareCodePointOrder(int32_t start,
563 inline int8_t compareCodePointOrder(int32_t start,
609 inline int8_t compareCodePointOrder(int32_t start,
634 inline int8_t compareCodePointOrder(int32_t start,
661 inline int8_t compareCodePointOrderBetween(int32_t start,
707 inline int8_t caseCompare(int32_t start,
734 inline int8_t caseCompare(int32_t start,
784 inline int8_t caseCompare(int32_t start,
811 inline int8_t caseCompare(int32_t start,
840 inline int8_t caseCompareBetween(int32_t start,
965 int32_t start)
const;
980 int32_t length)
const;
1002 int32_t length)
const;
1015 inline int32_t indexOf(
const char16_t *
srcChars,
1017 int32_t start)
const;
1034 int32_t length)
const;
1056 int32_t length)
const;
1065 inline int32_t indexOf(
char16_t c)
const;
1075 inline int32_t indexOf(
UChar32 c)
const;
1085 inline int32_t indexOf(
char16_t c,
1086 int32_t start)
const;
1097 inline int32_t indexOf(
UChar32 c,
1098 int32_t start)
const;
1110 inline int32_t indexOf(
char16_t c,
1112 int32_t length)
const;
1125 inline int32_t indexOf(
UChar32 c,
1127 int32_t length)
const;
1137 inline int32_t lastIndexOf(
const UnicodeString& text)
const;
1149 int32_t start)
const;
1164 int32_t length)
const;
1186 int32_t length)
const;
1198 inline int32_t lastIndexOf(
const char16_t *
srcChars,
1200 int32_t start)
const;
1217 int32_t length)
const;
1239 int32_t length)
const;
1248 inline int32_t lastIndexOf(
char16_t c)
const;
1258 inline int32_t lastIndexOf(
UChar32 c)
const;
1268 inline int32_t lastIndexOf(
char16_t c,
1269 int32_t start)
const;
1280 inline int32_t lastIndexOf(
UChar32 c,
1281 int32_t start)
const;
1293 inline int32_t lastIndexOf(
char16_t c,
1295 int32_t length)
const;
1308 inline int32_t lastIndexOf(
UChar32 c,
1310 int32_t length)
const;
1323 inline char16_t charAt(int32_t offset)
const;
1332 inline char16_t operator[] (int32_t offset)
const;
1451 inline void extract(int32_t start,
1491 inline void extract(int32_t start,
1551#if U_CHARSET_IS_UTF8 || !UCONFIG_NO_CONVERSION
1579#if !UCONFIG_NO_CONVERSION
1606 inline int32_t extract(int32_t start,
1721 template<
typename StringClass>
1755 inline int32_t
length(
void)
const;
1804 inline UBool isEmpty(
void)
const;
1815 inline int32_t getCapacity(
void)
const;
1824 inline int32_t hashCode(
void)
const;
1838 inline UBool isBogus(
void)
const;
1903 return moveFrom(
src);
2052 int32_t textLength);
2495 virtual void copy(int32_t start, int32_t limit, int32_t
dest);
2695#if !UCONFIG_NO_BREAK_ITERATION
2905 inline const char16_t *getBuffer()
const;
2998#if !U_CHAR16_IS_TYPEDEF
3013#if U_SIZEOF_WCHAR_T==2 || defined(U_IN_DOXYGEN)
3049 int32_t textLength);
3051#if !U_CHAR16_IS_TYPEDEF
3063#if U_SIZEOF_WCHAR_T==2 || defined(U_IN_DOXYGEN)
3083 inline UnicodeString(
const std::nullptr_t text, int32_t length);
3109 int32_t textLength);
3131#if !U_CHAR16_IS_TYPEDEF
3144#if U_SIZEOF_WCHAR_T==2 || defined(U_IN_DOXYGEN)
3168#if U_CHARSET_IS_UTF8 || !UCONFIG_NO_CONVERSION
3203#if !UCONFIG_NO_CONVERSION
3499 toUTF8(int32_t start, int32_t len,
3500 char *target, int32_t capacity)
const;
3509 doCompare(int32_t start,
3515 int8_t doCompare(int32_t start,
3522 doCompareCodePointOrder(int32_t start,
3528 int8_t doCompareCodePointOrder(int32_t start,
3535 doCaseCompare(int32_t start,
3543 doCaseCompare(int32_t start,
3550 int32_t doIndexOf(
char16_t c,
3552 int32_t length)
const;
3556 int32_t length)
const;
3558 int32_t doLastIndexOf(
char16_t c,
3560 int32_t length)
const;
3562 int32_t doLastIndexOf(
UChar32 c,
3564 int32_t length)
const;
3566 void doExtract(int32_t start,
3571 inline void doExtract(int32_t start,
3575 inline char16_t doCharAt(int32_t offset)
const;
3596 int32_t doHashCode(
void)
const;
3600 inline char16_t* getArrayStart(
void);
3601 inline const char16_t* getArrayStart(
void)
const;
3603 inline UBool hasShortLength()
const;
3604 inline int32_t getShortLength()
const;
3608 inline UBool isWritable()
const;
3611 inline UBool isBufferWritable()
const;
3614 inline void setZeroLength();
3615 inline void setShortLength(int32_t len);
3616 inline void setLength(int32_t len);
3617 inline void setToEmpty();
3618 inline void setArray(
char16_t *array, int32_t len, int32_t capacity);
3625 UBool allocate(int32_t capacity);
3628 void releaseArray(
void);
3640 inline void pinIndex(int32_t& start)
const;
3641 inline void pinIndices(int32_t& start,
3642 int32_t& length)
const;
3644#if !UCONFIG_NO_CONVERSION
3647 int32_t doExtract(int32_t start, int32_t length,
3709 int32_t removeRef(
void);
3710 int32_t refCount(
void)
const;
3720 kInvalidUChar=0xffff,
3726 kUsingStackBuffer=2,
3728 kBufferIsReadonly=8,
3731 kAllStorageFlags=0x1f,
3734 kLength1=1<<kLengthShift,
3735 kMaxShortLength=0x3ff,
3736 kLengthIsLarge=0xffe0,
3739 kShortString=kUsingStackBuffer,
3740 kLongString=kRefCounted,
3741 kReadonlyAlias=kBufferIsReadonly,
3747 union StackBufferOrFields;
3748 friend union StackBufferOrFields;
3791 union StackBufferOrFields {
3795 int16_t fLengthAndFlags;
3796 char16_t fBuffer[US_STACKBUF_SIZE];
3799 int16_t fLengthAndFlags;
3829UnicodeString::pinIndex(int32_t& start)
const
3834 }
else if(start > length()) {
3840UnicodeString::pinIndices(int32_t& start,
3841 int32_t& _length)
const
3844 int32_t len = length();
3847 }
else if(start > len) {
3852 }
else if(_length > (len - start)) {
3853 _length = (len - start);
3858UnicodeString::getArrayStart() {
3859 return (fUnion.fFields.fLengthAndFlags&kUsingStackBuffer) ?
3860 fUnion.fStackFields.fBuffer : fUnion.fFields.fArray;
3863inline const char16_t*
3864UnicodeString::getArrayStart()
const {
3865 return (fUnion.fFields.fLengthAndFlags&kUsingStackBuffer) ?
3866 fUnion.fStackFields.fBuffer : fUnion.fFields.fArray;
3874UnicodeString::UnicodeString() {
3875 fUnion.fStackFields.fLengthAndFlags=kShortString;
3878inline UnicodeString::UnicodeString(
const std::nullptr_t ) {
3879 fUnion.fStackFields.fLengthAndFlags=kShortString;
3882inline UnicodeString::UnicodeString(
const std::nullptr_t , int32_t ) {
3883 fUnion.fStackFields.fLengthAndFlags=kShortString;
3886inline UnicodeString::UnicodeString(std::nullptr_t , int32_t , int32_t ) {
3887 fUnion.fStackFields.fLengthAndFlags=kShortString;
3894UnicodeString::hasShortLength()
const {
3895 return fUnion.fFields.fLengthAndFlags>=0;
3899UnicodeString::getShortLength()
const {
3902 return fUnion.fFields.fLengthAndFlags>>kLengthShift;
3906UnicodeString::length()
const {
3907 return hasShortLength() ? getShortLength() : fUnion.fFields.fLength;
3911UnicodeString::getCapacity()
const {
3912 return (fUnion.fFields.fLengthAndFlags&kUsingStackBuffer) ?
3913 US_STACKBUF_SIZE : fUnion.fFields.fCapacity;
3917UnicodeString::hashCode()
const
3918{
return doHashCode(); }
3921UnicodeString::isBogus()
const
3922{
return (
UBool)(fUnion.fFields.fLengthAndFlags & kIsBogus); }
3925UnicodeString::isWritable()
const
3926{
return (
UBool)!(fUnion.fFields.fLengthAndFlags&(kOpenGetBuffer|kIsBogus)); }
3929UnicodeString::isBufferWritable()
const
3932 !(fUnion.fFields.fLengthAndFlags&(kOpenGetBuffer|kIsBogus|kBufferIsReadonly)) &&
3933 (!(fUnion.fFields.fLengthAndFlags&kRefCounted) || refCount()==1));
3936inline const char16_t *
3937UnicodeString::getBuffer()
const {
3938 if(fUnion.fFields.fLengthAndFlags&(kIsBogus|kOpenGetBuffer)) {
3940 }
else if(fUnion.fFields.fLengthAndFlags&kUsingStackBuffer) {
3941 return fUnion.fStackFields.fBuffer;
3943 return fUnion.fFields.fArray;
3951UnicodeString::doCompare(int32_t start,
3958 return (int8_t)!isBogus();
3960 srcText.pinIndices(srcStart, srcLength);
3961 return doCompare(start, thisLength, srcText.getArrayStart(), srcStart, srcLength);
3971 int32_t len = length(), textLength = text.
length();
3972 return !text.
isBogus() && len == textLength && doEquals(text, len);
3978{
return (!
operator==(text)); }
3982{
return doCompare(0, length(), text, 0, text.
length()) == 1; }
3986{
return doCompare(0, length(), text, 0, text.
length()) == -1; }
3990{
return doCompare(0, length(), text, 0, text.
length()) != -1; }
3994{
return doCompare(0, length(), text, 0, text.
length()) != 1; }
3998{
return doCompare(0, length(), text, 0, text.
length()); }
4001UnicodeString::compare(int32_t start,
4012UnicodeString::compare(int32_t start,
4020UnicodeString::compare(int32_t start,
4026UnicodeString::compare(int32_t start,
4034UnicodeString::compareBetween(int32_t start,
4039{
return doCompare(start, limit - start,
4043UnicodeString::doCompareCodePointOrder(int32_t start,
4050 return (int8_t)!isBogus();
4052 srcText.pinIndices(srcStart, srcLength);
4053 return doCompareCodePointOrder(start, thisLength, srcText.getArrayStart(), srcStart, srcLength);
4059{
return doCompareCodePointOrder(0, length(), text, 0, text.
length()); }
4062UnicodeString::compareCodePointOrder(int32_t start,
4073UnicodeString::compareCodePointOrder(int32_t start,
4081UnicodeString::compareCodePointOrder(int32_t start,
4087UnicodeString::compareCodePointOrder(int32_t start,
4095UnicodeString::compareCodePointOrderBetween(int32_t start,
4100{
return doCompareCodePointOrder(start, limit - start,
4104UnicodeString::doCaseCompare(int32_t start,
4112 return (int8_t)!isBogus();
4114 srcText.pinIndices(srcStart, srcLength);
4115 return doCaseCompare(start, thisLength, srcText.getArrayStart(), srcStart, srcLength, options);
4121 return doCaseCompare(0, length(), text, 0, text.
length(),
options);
4125UnicodeString::caseCompare(int32_t start,
4140UnicodeString::caseCompare(int32_t start,
4150UnicodeString::caseCompare(int32_t start,
4158UnicodeString::caseCompare(int32_t start,
4168UnicodeString::caseCompareBetween(int32_t start,
4195{
return indexOf(text, 0, text.
length(), 0, length()); }
4199 int32_t start)
const {
4201 return indexOf(text, 0, text.
length(), start, length() - start);
4213 int32_t start)
const {
4226UnicodeString::indexOf(
char16_t c,
4229{
return doIndexOf(c, start,
_length); }
4235{
return doIndexOf(c, start,
_length); }
4238UnicodeString::indexOf(
char16_t c)
const
4239{
return doIndexOf(c, 0, length()); }
4243{
return indexOf(c, 0, length()); }
4246UnicodeString::indexOf(
char16_t c,
4247 int32_t start)
const {
4249 return doIndexOf(c, start, length() - start);
4254 int32_t start)
const {
4256 return indexOf(c, start, length() - start);
4269 int32_t start)
const {
4294{
return lastIndexOf(text, 0, text.
length(), start,
_length); }
4298 int32_t start)
const {
4300 return lastIndexOf(text, 0, text.
length(), start, length() - start);
4305{
return lastIndexOf(text, 0, text.
length(), 0, length()); }
4308UnicodeString::lastIndexOf(
char16_t c,
4311{
return doLastIndexOf(c, start,
_length); }
4317 return doLastIndexOf(c, start,
_length);
4321UnicodeString::lastIndexOf(
char16_t c)
const
4322{
return doLastIndexOf(c, 0, length()); }
4326 return lastIndexOf(c, 0, length());
4330UnicodeString::lastIndexOf(
char16_t c,
4331 int32_t start)
const {
4333 return doLastIndexOf(c, start, length() - start);
4338 int32_t start)
const {
4340 return lastIndexOf(c, start, length() - start);
4345{
return compare(0, text.
length(), text, 0, text.
length()) == 0; }
4371{
return doCompare(length() - text.
length(), text.
length(),
4372 text, 0, text.
length()) == 0; }
4408UnicodeString::replace(int32_t start,
4414UnicodeString::replace(int32_t start,
4422UnicodeString::replace(int32_t start,
4429UnicodeString::replace(int32_t start,
4437UnicodeString::replace(int32_t start,
4443UnicodeString::replaceBetween(int32_t start,
4446{
return doReplace(start, limit - start,
srcText, 0,
srcText.length()); }
4449UnicodeString::replaceBetween(int32_t start,
4459{
return findAndReplace(0, length(),
oldText, 0,
oldText.length(),
4463UnicodeString::findAndReplace(int32_t start,
4474UnicodeString::doExtract(int32_t start,
4480UnicodeString::extract(int32_t start,
4487UnicodeString::extract(int32_t start,
4490{ doExtract(start,
_length, target); }
4492#if !UCONFIG_NO_CONVERSION
4495UnicodeString::extract(int32_t start,
4508UnicodeString::extractBetween(int32_t start,
4518UnicodeString::tempSubStringBetween(int32_t start, int32_t limit)
const {
4519 return tempSubString(start, limit - start);
4523UnicodeString::doCharAt(int32_t offset)
const
4525 if((uint32_t)offset < (uint32_t)length()) {
4526 return getArrayStart()[offset];
4528 return kInvalidUChar;
4533UnicodeString::charAt(int32_t offset)
const
4534{
return doCharAt(offset); }
4537UnicodeString::operator[] (int32_t offset)
const
4538{
return doCharAt(offset); }
4541UnicodeString::isEmpty()
const {
4543 return (fUnion.fFields.fLengthAndFlags>>kLengthShift) == 0;
4550UnicodeString::setZeroLength() {
4551 fUnion.fFields.fLengthAndFlags &= kAllStorageFlags;
4555UnicodeString::setShortLength(int32_t len) {
4557 fUnion.fFields.fLengthAndFlags =
4558 (int16_t)((fUnion.fFields.fLengthAndFlags & kAllStorageFlags) | (len << kLengthShift));
4562UnicodeString::setLength(int32_t len) {
4563 if(len <= kMaxShortLength) {
4564 setShortLength(len);
4566 fUnion.fFields.fLengthAndFlags |= kLengthIsLarge;
4567 fUnion.fFields.fLength = len;
4572UnicodeString::setToEmpty() {
4573 fUnion.fFields.fLengthAndFlags = kShortString;
4577UnicodeString::setArray(
char16_t *array, int32_t len, int32_t capacity) {
4579 fUnion.fFields.fArray = array;
4580 fUnion.fFields.fCapacity = capacity;
4583inline UnicodeString&
4584UnicodeString::operator= (
char16_t ch)
4585{
return doReplace(0, length(), &
ch, 0, 1); }
4589{
return replace(0, length(),
ch); }
4627 return doReplace(0, length(), &
srcChar, 0, 1);
4634 return replace(0, length(),
srcChar);
4660{
return doAppend(&
srcChar, 0, 1); }
4663UnicodeString::operator+= (
char16_t ch)
4664{
return doAppend(&
ch, 0, 1); }
4676UnicodeString::insert(int32_t start,
4683UnicodeString::insert(int32_t start,
4688UnicodeString::insert(int32_t start,
4695UnicodeString::insert(int32_t start,
4701UnicodeString::insert(int32_t start,
4703{
return doReplace(start, 0, &
srcChar, 0, 1); }
4706UnicodeString::insert(int32_t start,
4708{
return replace(start, 0,
srcChar); }
4712UnicodeString::remove()
4724UnicodeString::remove(int32_t start,
4735UnicodeString::removeBetween(int32_t start,
4737{
return doReplace(start, limit - start,
NULL, 0, 0); }
4740UnicodeString::retainBetween(int32_t start, int32_t limit) {
4742 return doReplace(0, start,
NULL, 0, 0);
4752 }
else if((uint32_t)
targetLength < (uint32_t)length()) {
4761UnicodeString::reverse()
4762{
return doReverse(0, length()); }
4765UnicodeString::reverse(int32_t start,
4767{
return doReverse(start,
_length); }
C++ API: Interface for writing bytes, and implementation classes.
C++ API: char16_t pointer wrappers with implicit conversion from bit-compatible raw pointer types.
The BreakIterator class implements methods for finding the location of boundaries in text.
A ByteSink can be filled with bytes.
char16_t * wrapper with implicit conversion from distinct but bit-compatible pointer types.
const char16_t * wrapper with implicit conversion from distinct but bit-compatible pointer types.
Records lengths of string edits but not replacement text.
"Smart pointer" base class; do not use directly: use LocalPointer etc.
A Locale object represents a specific geographical, political, or cultural region.
Replaceable is an abstract base class representing a string of characters that supports the replaceme...
virtual void extractBetween(int32_t start, int32_t limit, UnicodeString &target) const =0
Copies characters in the range [start, limit) into the UnicodeString target.
char16_t charAt(int32_t offset) const
Returns the 16-bit code unit at the given offset into the text.
int32_t length() const
Returns the number of 16-bit code units in the text.
A string-like object that points to a sized piece of memory.
An Appendable implementation which writes to a UnicodeString.
UnicodeString is a string class that stores Unicode characters directly and provides similar function...
int32_t indexOf(const char16_t *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 srcChar...
UnicodeString(const UnicodeString &that)
Copy constructor.
virtual UChar32 getChar32At(int32_t offset) const
The change in Replaceable to use virtual getChar32At() allows UnicodeString::char32At() to be inline ...
UnicodeString & setTo(char16_t *buffer, int32_t buffLength, int32_t buffCapacity)
Aliasing setTo() function, analogous to the writable-aliasing char16_t* constructor.
UChar32 unescapeAt(int32_t &offset) const
Unescape a single escape sequence and return the represented character.
UBool hasMoreChar32Than(int32_t start, int32_t length, int32_t number) const
Check if the length char16_t code units of the string contain more Unicode code points than a certain...
UnicodeString(const UnicodeString &src, int32_t srcStart, int32_t srcLength)
'Substring' constructor from subrange of source string.
virtual void extractBetween(int32_t start, int32_t limit, UnicodeString &target) const
Copy the characters in the range [start, limit) into the UnicodeString target.
virtual ~UnicodeString()
Destructor.
UnicodeString(const char *codepageData, int32_t dataLength, const char *codepage)
char* constructor.
UnicodeString(const char *codepageData, const char *codepage)
char* constructor.
UnicodeString(UBool isTerminated, ConstChar16Ptr text, int32_t textLength)
Readonly-aliasing char16_t* constructor.
UnicodeString & toTitle(BreakIterator *titleIter, const Locale &locale, uint32_t options)
Titlecase this string, with options.
UnicodeString & append(UChar32 srcChar)
Append the code point srcChar to the UnicodeString object.
EInvariant
Constant to be used in the UnicodeString(char *, int32_t, EInvariant) constructor which constructs a ...
UnicodeString unescape() const
Unescape a string of characters and return a string containing the result.
UnicodeString(const UnicodeString &src, int32_t srcStart)
'Substring' constructor from tail of source string.
UnicodeString(const wchar_t *text, int32_t length)
wchar_t * constructor.
int32_t getChar32Limit(int32_t offset) const
Adjust a random-access offset so that it points behind a Unicode character.
UnicodeString(char16_t *buffer, int32_t buffLength, int32_t buffCapacity)
Writable-aliasing char16_t* constructor.
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 t...
UnicodeString(int32_t capacity, UChar32 c, int32_t count)
Construct a UnicodeString with capacity to hold capacity char16_ts.
UNISTR_FROM_STRING_EXPLICIT UnicodeString(const uint16_t *text)
uint16_t * constructor.
void swap(UnicodeString &other)
Swap strings.
int32_t extract(int32_t start, int32_t startLength, char *target, uint32_t targetLength, const char *codepage) const
Copy the characters in the range [start, start + length) into an array of characters in a specified c...
virtual int32_t getLength() const
Implement Replaceable::getLength() (see jitterbug 1027).
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 ran...
UnicodeString & toTitle(BreakIterator *titleIter)
Titlecase this string, convenience function using the default locale.
UnicodeString & fastCopyFrom(const UnicodeString &src)
Almost the same as the assignment operator.
UBool padLeading(int32_t targetLength, char16_t padChar=0x0020)
Pad the start of this UnicodeString with the character padChar.
int32_t getChar32Start(int32_t offset) const
Adjust a random-access offset so that it points to the beginning of a Unicode character.
UChar32 char32At(int32_t offset) const
Return the code point that contains the code unit at offset offset.
UnicodeString & trim(void)
Trims leading and trailing whitespace from this UnicodeString.
int32_t length(void) const
Return the length of the UnicodeString object.
UnicodeString tempSubString(int32_t start=0, int32_t length=INT32_MAX) const
Create a temporary substring for the specified range.
int32_t extract(Char16Ptr dest, int32_t destCapacity, UErrorCode &errorCode) const
Copy the contents of the string into dest.
int32_t extract(int32_t start, int32_t startLength, char *target, uint32_t targetLength) const
Copy the characters in the range [start, start + length) into an array of characters in the platform'...
static UnicodeString fromUTF8(StringPiece utf8)
Create a UnicodeString from a UTF-8 string.
UNISTR_FROM_CHAR_EXPLICIT UnicodeString(char16_t ch)
Single char16_t (code unit) constructor.
int32_t lastIndexOf(const char16_t *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...
UnicodeString(wchar_t *buffer, int32_t buffLength, int32_t buffCapacity)
Writable-aliasing wchar_t * constructor.
void setToBogus()
Make this UnicodeString object invalid.
virtual void handleReplaceBetween(int32_t start, int32_t limit, const UnicodeString &text)
Replace a substring of this object with the given text.
int32_t moveIndex32(int32_t index, int32_t delta) const
Move the code unit index along the string by delta code points.
static UnicodeString fromUTF32(const UChar32 *utf32, int32_t length)
Create a UnicodeString from a UTF-32 string.
UnicodeString & replace(int32_t start, int32_t length, UChar32 srcChar)
Replace the characters in the range [start, start + length) with the code point srcChar.
virtual UBool hasMetaData() const
Replaceable API.
int32_t countChar32(int32_t start=0, int32_t length=INT32_MAX) const
Count Unicode code points in the length char16_t code units of the string.
UnicodeString & toUpper(void)
Convert the characters in this to UPPER CASE following the conventions of the default locale.
UNISTR_FROM_CHAR_EXPLICIT UnicodeString(UChar32 ch)
Single UChar32 (code point) constructor.
virtual void copy(int32_t start, int32_t limit, int32_t dest)
Copy a substring of this object, retaining attribute (out-of-band) information.
virtual Replaceable * clone() const
Clone this object, an instance of a subclass of Replaceable.
UnicodeString & operator=(const UnicodeString &srcText)
Assignment operator.
UnicodeString & setTo(UBool isTerminated, ConstChar16Ptr text, int32_t textLength)
Aliasing setTo() function, analogous to the readonly-aliasing char16_t* constructor.
UnicodeString & moveFrom(UnicodeString &src)
Move assignment; might leave src in bogus state.
int32_t extract(char *dest, int32_t destCapacity, UConverter *cnv, UErrorCode &errorCode) const
Convert the UnicodeString into a codepage string using an existing UConverter.
StringClass & toUTF8String(StringClass &result) const
Convert the UnicodeString to UTF-8 and append the result to a standard string.
UnicodeString(const char *src, int32_t length, enum EInvariant inv)
Constructs a Unicode string from an invariant-character char * string.
UnicodeString(const char16_t *text, int32_t textLength)
char16_t* constructor.
UnicodeString(const char *src, int32_t srcLength, UConverter *cnv, UErrorCode &errorCode)
char * / UConverter constructor.
UnicodeString(const char *codepageData, int32_t dataLength)
char* constructor.
static UClassID getStaticClassID()
ICU "poor man's RTTI", returns a UClassID for this class.
UnicodeString(uint16_t *buffer, int32_t buffLength, int32_t buffCapacity)
Writable-aliasing uint16_t * constructor.
int32_t toUTF32(UChar32 *utf32, int32_t capacity, UErrorCode &errorCode) const
Convert the UnicodeString to UTF-32.
UnicodeString & toLower(const Locale &locale)
Convert the characters in this to lower case following the conventions of a specific locale.
UnicodeString & toTitle(BreakIterator *titleIter, const Locale &locale)
Titlecase this string.
UnicodeString & foldCase(uint32_t options=0)
Case-folds the characters in this string.
UnicodeString(UnicodeString &&src)
Move constructor; might leave src in bogus state.
const char16_t * getTerminatedBuffer()
Get a read-only pointer to the internal buffer, making sure that it is NUL-terminated.
UNISTR_FROM_STRING_EXPLICIT UnicodeString(const char16_t *text)
char16_t* constructor.
UnicodeString & toUpper(const Locale &locale)
Convert the characters in this to UPPER CASE following the conventions of a specific locale.
UnicodeString & setCharAt(int32_t offset, char16_t ch)
Set the character at the specified offset to the specified character.
int32_t extract(int32_t start, int32_t startLength, char *target, int32_t targetCapacity, enum EInvariant inv) const
Copy the characters in the range [start, start + startLength) into an array of characters.
UNISTR_FROM_STRING_EXPLICIT UnicodeString(const wchar_t *text)
wchar_t * constructor.
virtual char16_t getCharAt(int32_t offset) const
The change in Replaceable to use virtual getCharAt() allows UnicodeString::charAt() to be inline agai...
UBool isBogus(void) const
Determine if this object contains a valid string.
char16_t * getBuffer(int32_t minCapacity)
Get a read/write pointer to the internal buffer.
UBool padTrailing(int32_t targetLength, char16_t padChar=0x0020)
Pad the end of this UnicodeString with the character padChar.
UNISTR_FROM_STRING_EXPLICIT UnicodeString(const char *codepageData)
char* constructor.
UnicodeString & operator=(UnicodeString &&src)
Move assignment operator; might leave src in bogus state.
void releaseBuffer(int32_t newLength=-1)
Release a read/write buffer on a UnicodeString object with an "open" getBuffer(minCapacity).
void toUTF8(ByteSink &sink) const
Convert the UnicodeString to UTF-8 and write the result to a ByteSink.
friend U_COMMON_API void swap(UnicodeString &s1, UnicodeString &s2)
Non-member UnicodeString swap function.
virtual UClassID getDynamicClassID() const
ICU "poor man's RTTI", returns a UClassID for the actual class.
UnicodeString(const uint16_t *text, int32_t length)
uint16_t * constructor.
UnicodeString & toLower(void)
Convert the characters in this to lower case following the conventions of the default locale.
U_EXPORT UBool operator==(const StringPiece &x, const StringPiece &y)
Global operator == for StringPiece.
UBool operator!=(const StringPiece &x, const StringPiece &y)
Global operator != for StringPiece.
const UChar * toUCharPtr(const char16_t *p)
Converts from const char16_t * to const UChar *.
C++ API: Replaceable String.
C++ API: Central ICU header for including the C++ standard <string> header and for related definition...
C++ API: StringPiece: Read-only byte string wrapper class.
struct UConverter UConverter
#define UCONFIG_NO_BREAK_ITERATION
This switch turns off break iteration.
int32_t UChar32
Define UChar32 as a type for single Unicode code points.
#define INT32_MAX
The largest value a 32 bit signed integer can hold.
int8_t UBool
The ICU boolean type.
uint16_t UChar
The base type for UTF-16 code units and pointers.
#define U_SIZEOF_UCHAR
Number of bytes in a UChar.
#define TRUE
The TRUE value of a UBool.
#define FALSE
The FALSE value of a UBool.
#define U_STABLE
This is used to declare a function as a stable public ICU C API.
#define UNISTR_FROM_CHAR_EXPLICIT
This can be defined to be empty or "explicit".
int32_t UStringCaseMapper(int32_t caseLocale, uint32_t options, icu::BreakIterator *iter, char16_t *dest, int32_t destCapacity, const char16_t *src, int32_t srcLength, icu::Edits *edits, UErrorCode &errorCode)
Internal string case mapping function type.
#define UNISTR_FROM_STRING_EXPLICIT
This can be defined to be empty or "explicit".
#define UNISTR_OBJECT_SIZE
Desired sizeof(UnicodeString) in bytes.
void * UClassID
UClassID is used to identify classes without using the compiler's RTTI.
Basic definitions for ICU, for both C and C++ APIs.
#define NULL
Define NULL if necessary, to nullptr for C++ and to ((void *)0) for C.
UErrorCode
Error code to replace exception handling, so that the code is compatible with all C++ compilers,...
#define U_COMMON_API
Set to export library symbols from inside the common library, and to import them from outside.
#define U_NAMESPACE_END
This is used to end a declaration of a public ICU C++ API.
#define U_NAMESPACE_BEGIN
This is used to begin a declaration of a public ICU C++ API.