Inheritance diagram for UString:
Public Types | |
typedef uint(* | Formatter )(wchar *dst, uint len, inout Error e) |
Public Member Functions | |
this (uint space=0) | |
this (wchar[] content, bool mutable=true) | |
this (UText other, bool mutable=false) | |
this (UString other, bool mutable=true) | |
UString | append (UText other) |
UString | append (UText other, uint start, uint len=uint.max) |
UString | append (wchar chr) |
UString | append (wchar[] chars) |
UString | setTo (wchar chr, uint start=0, uint len=uint.max) |
UString | setTo (wchar[] chars, bool mutable=true) |
UString | setTo (UText other, bool mutable=true) |
UString | setTo (UText other, uint start, uint len, bool mutable=true) |
UString | setCharAt (uint index, wchar chr) |
UString | trim () |
UString | remove (uint start, uint length=uint.max) |
UString | truncate (uint length=0) |
UString | padLeading (uint length, wchar padChar=0x0020) |
UString | padTrailing (uint length, wchar padChar=0x0020) |
package void | expand (uint count) |
package void | format (Formatter format, char[] msg) |
Private Types | |
enum | CaseOption { Default = 0, SpecialI = 1 } |
Private Member Functions | |
final void | realloc (uint count=0) |
final UString | append (wchar *chars, uint count) |
this (wchar[] content) | |
package wchar[] | get () |
override int | opEquals (Object o) |
override int | opCmp (Object o) |
override uint | toHash () |
UString | copy () |
UString | extract (uint start, uint len=uint.max) |
uint | codePoints (uint start=0, uint length=uint.max) |
bool | hasSurrogates (uint start=0, uint length=uint.max) |
wchar | charAt (uint index) |
uint | length () |
uint | compare (UString other, bool codePointOrder=false) |
uint | compare (wchar[] other, bool codePointOrder=false) |
uint | compareFolded (UString other, CaseOption option=CaseOption.Default) |
uint | compareFolded (wchar[] other, CaseOption option=CaseOption.Default) |
private uint | compareFolded (wchar[] s1, wchar[] s2, CaseOption option=CaseOption.Default) |
bool | startsWith (UText other) |
bool | startsWith (wchar[] chars) |
bool | endsWith (UText other) |
bool | endsWith (wchar[] chars) |
uint | indexOf (wchar c, uint start=0) |
uint | indexOf (UText other, uint start=0) |
uint | indexOf (wchar[] chars, uint start=0) |
uint | lastIndexOf (wchar c, uint start=uint.max) |
uint | lastIndexOf (UText other, uint start=uint.max) |
uint | lastIndexOf (wchar[] chars, uint start=uint.max) |
UString | toLower () |
UString | toLower (inout ULocale locale) |
UString | toUpper () |
UString | toUpper (inout ULocale locale) |
UString | toFolded (CaseOption option=CaseOption.Default) |
UString | unEscape () |
private void | pinIndex (inout uint x) |
private void | pinIndices (inout uint start, inout uint length) |
private UString | caseConvert (UString.Formatter cvt) |
Private Attributes | |
package uint | len |
package wchar[] | content |
In ICU, a Unicode string consists of 16-bit Unicode code units. A Unicode character may be stored with either one code unit — which is the most common case — 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 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 getChar32Start() and getChar32Limit()
UString methods are more lenient with regard to input parameter values than other ICU APIs. In particular:
Definition at line 149 of file UString.d.
|
Internal method to support formatting into this UString. This is used by many of the ICU wrappers to append content into a UString. |
|
|
|
Create an empty UString with the specified available space |
|
Create a UString upon the provided content. If said content is immutable (read-only) then you might consider setting the 'mutable' parameter to false. Doing so will avoid allocating heap-space for the content until it is modified via one of these methods. Definition at line 173 of file UString.d. References setTo(). |
|
Create a UString via the content of a UText. Note that the default is to assume the content is immutable (read-only). |
|
Create a UString via the content of a UString. If said content is immutable (read-only) then you might consider setting the 'mutable' parameter to false. Doing so will avoid allocating heap-space for the content until it is modified via one of these methods. |
|
Append text to this UString Definition at line 237 of file UString.d. References UText::get(). Referenced by append(), and UText::unEscape(). |
|
Append partial text to this UString Definition at line 248 of file UString.d. References append(), UText::content, and UText::pinIndices(). |
|
Append a single character to this UString Definition at line 260 of file UString.d. References append(). |
|
Append text to this UString Definition at line 271 of file UString.d. References append(). |
|
Set a section of this UString to the specified character Definition at line 282 of file UString.d. References UText::pinIndices(), and realloc(). Referenced by padLeading(), padTrailing(), setTo(), and this(). |
|
Set the content to the provided array. Parameter 'mutable' specifies whether the given array is likely to change. If not, the array is aliased until such time this UString is altered. |
|
Replace the content of this UString. If the new content is immutable (read-only) then you might consider setting the 'mutable' parameter to false. Doing so will avoid allocating heap-space for the content until it is modified via one of these methods. Definition at line 320 of file UString.d. References UText::get(), and setTo(). |
|
Replace the content of this UString. If the new content is immutable (read-only) then you might consider setting the 'mutable' parameter to false. Doing so will avoid allocating heap-space for the content until it is modified via one of these methods. Definition at line 335 of file UString.d. References UText::content, UText::pinIndices(), and setTo(). |
|
Replace the character at the specified location. Definition at line 347 of file UString.d. References UText::pinIndex(), and realloc(). |
|
Remove leading and trailing whitespace from this UString Definition at line 362 of file UString.d. References UText::charAt(), and remove(). Referenced by UText::test(). |
|
Remove a piece of this UString. Definition at line 383 of file UString.d. References memmove(), UText::pinIndices(), realloc(), and truncate(). Referenced by trim(). |
|
Truncate the length of this UString. Definition at line 407 of file UString.d. Referenced by remove(), and UText::unEscape(). |
|
Insert leading spaces in this UString Definition at line 420 of file UString.d. References expand(), memmove(), and setTo(). Referenced by UText::test(). |
|
Append some trailing spaces to this UString. Definition at line 434 of file UString.d. References expand(), and setTo(). Referenced by UText::test(). |
|
Check for available space within the buffer, and expand as necessary. Definition at line 448 of file UString.d. Referenced by append(), format(), padLeading(), and padTrailing(). |
|
Allocate memory dud to a change in the content. We handle the distinction between mutable and immutable here. Definition at line 461 of file UString.d. Referenced by remove(), setCharAt(), and setTo(). |
|
Internal method to support UString appending Definition at line 483 of file UString.d. References expand(). |
|
Definition at line 501 of file UString.d. References expand(), and ICU::isError(). Referenced by UText::caseConvert(), UNumberFormat::format(), UMessageFormat::format(), UDateFormat::format(), UTimeZone::getDefault(), UCommonFormat::getPattern(), UMessageFormat::getPattern(), UDateFormat::getPattern(), and UCalendar::getTimeZoneName(). |
|
Construct read-only wrapper around the given content |
|
Return the valid content from this UText Definition at line 599 of file UString.d. Referenced by UList::add(), append(), UText::compare(), UText::endsWith(), UTimeZone::getDefault(), UText::indexOf(), UText::lastIndexOf(), UDecimalFormat::setPattern(), UMessageFormat::setPattern(), UDateFormat::setPattern(), setTo(), and UText::startsWith(). |
|
Is this UText equal to another? Definition at line 610 of file UString.d. References UText::content, and UText::len. |
|
Compare this UText to another. Definition at line 626 of file UString.d. References UText::content, and UText::len. |
|
Hash this UText |
|
Clone this UText into a UString Definition at line 653 of file UString.d. References UString. |
|
Clone a section of this UText into a UString Definition at line 664 of file UString.d. References UText::pinIndices(), and UString. |
|
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. Definition at line 679 of file UString.d. References UText::pinIndices(). Referenced by UText::hasSurrogates(). |
|
Return an indication whether or not there are surrogate pairs within the string. Definition at line 692 of file UString.d. References UText::codePoints(), and UText::pinIndices(). |
|
Return the character at the specified position. Definition at line 704 of file UString.d. Referenced by trim(), and UText::unEscape(). |
|
Return the length of the valid content Definition at line 715 of file UString.d. Referenced by UDecimalFormat::setPattern(), and UDateFormat::setPattern(). |
|
The comparison can be done in code unit order or in code point order. They differ only in UTF-16 when comparing supplementary code points (U+10000..U+10ffff) to BMP code points near the end of the BMP (i.e., U+e000..U+ffff). In code unit order, high BMP code points sort after supplementary code points because they are stored as pairs of surrogates which are at U+d800..U+dfff. Definition at line 733 of file UString.d. References UText::get(). |
|
The comparison can be done in code unit order or in code point order. They differ only in UTF-16 when comparing supplementary code points (U+10000..U+10ffff) to BMP code points near the end of the BMP (i.e., U+e000..U+ffff). In code unit order, high BMP code points sort after supplementary code points because they are stored as pairs of surrogates which are at U+d800..U+dfff. |
|
The comparison can be done in UTF-16 code unit order or in code point order. They differ only when comparing supplementary code points (U+10000..U+10ffff) to BMP code points near the end of the BMP (i.e., U+e000..U+ffff). In code unit order, high BMP code points sort after supplementary code points because they are stored as pairs of surrogates which are at U+d800..U+dfff. Definition at line 769 of file UString.d. References UText::content. Referenced by UText::compareFolded(), UText::endsWith(), and UText::startsWith(). |
|
The comparison can be done in UTF-16 code unit order or in code point order. They differ only when comparing supplementary code points (U+10000..U+10ffff) to BMP code points near the end of the BMP (i.e., U+e000..U+ffff). In code unit order, high BMP code points sort after supplementary code points because they are stored as pairs of surrogates which are at U+d800..U+dfff. Definition at line 787 of file UString.d. References UText::compareFolded(). |
|
Helper for comparison methods Definition at line 1134 of file UString.d. References ICU::testError(). |
|
Does this UText start with specified string? Definition at line 798 of file UString.d. References UText::get(). |
|
Does this UText start with specified string? Definition at line 809 of file UString.d. References UText::compareFolded(). |
|
Does this UText end with specified string? Definition at line 822 of file UString.d. References UText::get(). |
|
Does this UText end with specified string? Definition at line 833 of file UString.d. References UText::compareFolded(). |
|
Find the first occurrence of a BMP code point in a string. A surrogate code point is found only if its match in the text is not part of a surrogate pair. Definition at line 848 of file UString.d. References UText::pinIndex(). Referenced by UText::indexOf(), and UText::test(). |
|
Find the first occurrence of a substring in a string. The substring is found at code point boundaries. That means that if the substring begins with a trail surrogate or ends with a lead surrogate, then it is found only if these surrogates stand alone in the text. Otherwise, the substring edge units would be matched against halves of surrogate pairs. Definition at line 869 of file UString.d. References UText::get(), and UText::indexOf(). |
|
Find the first occurrence of a substring in a string. The substring is found at code point boundaries. That means that if the substring begins with a trail surrogate or ends with a lead surrogate, then it is found only if these surrogates stand alone in the text. Otherwise, the substring edge units would be matched against halves of surrogate pairs. Definition at line 886 of file UString.d. References UText::pinIndex(). |
|
Find the last occurrence of a BMP code point in a string. A surrogate code point is found only if its match in the text is not part of a surrogate pair. Definition at line 903 of file UString.d. References UText::pinIndex(). Referenced by UText::lastIndexOf(). |
|
Find the last occurrence of a BMP code point in a string. A surrogate code point is found only if its match in the text is not part of a surrogate pair. Definition at line 920 of file UString.d. References UText::get(), and UText::lastIndexOf(). |
|
Find the last occurrence of a substring in a string. The substring is found at code point boundaries. That means that if the substring begins with a trail surrogate or ends with a lead surrogate, then it is found only if these surrogates stand alone in the text. Otherwise, the substring edge units would be matched against halves of surrogate pairs. Definition at line 937 of file UString.d. References UText::pinIndex(). |
|
Lowercase the characters into a seperate UString. Casing is locale-dependent and context-sensitive. The result may be longer or shorter than the original. |
|
Lowercase the characters into a seperate UString. Casing is locale-dependent and context-sensitive. The result may be longer or shorter than the original. Definition at line 969 of file UString.d. References UText::caseConvert(), and ICU::toString(). |
|
Uppercase the characters into a seperate UString. Casing is locale-dependent and context-sensitive. The result may be longer or shorter than the original. Definition at line 988 of file UString.d. Referenced by UText::test(). |
|
Uppercase the characters into a seperate UString. Casing is locale-dependent and context-sensitive. The result may be longer or shorter than the original. Definition at line 1002 of file UString.d. References UText::caseConvert(), and ICU::toString(). |
|
Case-fold the characters into a seperate UString. 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. Definition at line 1024 of file UString.d. References UText::caseConvert(). |
|
Unescape a string of characters and write the resulting Unicode characters to the destination buffer. The following escape sequences are recognized: uhhhh 4 hex digits; h in [0-9A-Fa-f] Uhhhhhhhh 8 hex digits xhh 1-2 hex digits x{h...} 1-8 hex digits ooo 1-3 octal digits; o in [0-7] cX control-X; X is masked with 0x1F as well as the standard ANSI C escapes: a => U+0007, \b => U+0008, \t => U+0009, \n => U+000A, v => U+000B, \f => U+000C, \r => U+000D, \e => U+001B, \" =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. Definition at line 1062 of file UString.d. References append(), UText::charAt(), truncate(), and UString. Referenced by UText::test(). |
|
Pin the given index to a valid position. Definition at line 1107 of file UString.d. Referenced by UText::indexOf(), UText::lastIndexOf(), and setCharAt(). |
|
Pin the given index and length to a valid position. Definition at line 1119 of file UString.d. Referenced by append(), UText::codePoints(), UText::extract(), UText::hasSurrogates(), remove(), and setTo(). |
|
Helper for conversion methods Definition at line 1149 of file UString.d. References format(), and UString. Referenced by UText::toFolded(), UText::toLower(), and UText::toUpper(). |
|
Definition at line 535 of file UString.d. Referenced by UText::opCmp(), UText::opEquals(), UDateFormat::parse(), UNumberFormat::parseDouble(), UNumberFormat::parseInteger(), UNumberFormat::parseLong(), and UMessageFormat::setPattern(). |
|
Definition at line 536 of file UString.d. Referenced by append(), UText::compareFolded(), UText::opCmp(), UText::opEquals(), UDateFormat::parse(), UNumberFormat::parseDouble(), UNumberFormat::parseInteger(), UNumberFormat::parseLong(), and setTo(). |