[Serializable] |
ctor #1 | Default constructor. This constructor is called by derived class constructors to initialize state in this type. |
Equals (inherited from System.Object) |
See base class member description: System.Object.Equals Derived from System.Object, the primary base class for all objects. |
GetHashCode (inherited from System.Object) |
See base class member description: System.Object.GetHashCode Derived from System.Object, the primary base class for all objects. |
GetNextTextElement | Overloaded:GetNextTextElement(string str) Gets the first text element in a specified string. |
GetNextTextElement | Overloaded:GetNextTextElement(string str, int index) Gets the text element at the specified index of the specified string. |
GetTextElementEnumerator | Overloaded:GetTextElementEnumerator(string str) Returns an enumerator that can iterate through the text elements of the entire string. |
GetTextElementEnumerator | Overloaded:GetTextElementEnumerator(string str, int index) Returns an enumerator that can iterate through the text elements of the string, starting at the specified index. |
GetType (inherited from System.Object) |
See base class member description: System.Object.GetType Derived from System.Object, the primary base class for all objects. |
ParseCombiningCharacters | Returns the indexes of each base character, high-surrogate, or control character within the specified string. |
ToString (inherited from System.Object) |
See base class member description: System.Object.ToString Derived from System.Object, the primary base class for all objects. |
Finalize (inherited from System.Object) |
See base class member description: System.Object.Finalize Derived from System.Object, the primary base class for all objects. |
MemberwiseClone (inherited from System.Object) |
See base class member description: System.Object.MemberwiseClone Derived from System.Object, the primary base class for all objects. |
Hierarchy:
public StringInfo(); |
~StringInfo(); |
public virtual int GetHashCode(); |
str
Exception Type | Condition |
---|---|
ArgumentNullException | str is null. |
This method only returns the first text element. To iterate through the text elements of the string, use the TextElementEnumerator generated by the StringInfo.GetTextElementEnumerator method.
str
index
Exception Type | Condition |
---|---|
ArgumentNullException | str is null. |
ArgumentOutOfRangeException | index is outside the range of valid indexes for str. |
This method only returns the first text element of the substring that starts at the specified index. To iterate through the text elements of the string, use the TextElementEnumerator generated by the StringInfo.GetTextElementEnumerator method.
public static TextElementEnumerator GetTextElementEnumerator( |
str
Exception Type | Condition |
---|---|
ArgumentNullException | str is null. |
Text element enumerators are intended to be used only to read data in the string. Enumerators cannot be used to modify the underlying string.
The enumerator does not have exclusive access to the string.
When an enumerator is created, it takes a snapshot of the current state of the string. If changes are made to the string, such as adding, modifying, or deleting text elements, the snapshot gets out of sync and the enumerator throws an InvalidOperationException. Two enumerators created from the same string at the same time can have different snapshots of the string.
The enumerator is in an invalid state if it is positioned before the first text element in the string or after the last text element in the string. Whenever the enumerator is in an invalid state, calling TextElementEnumerator.Current throws an exception.
Initially, the enumerator is positioned before the first text element in the string. TextElementEnumerator.Reset also brings the enumerator back to this position. Therefore, after an enumerator is created or after a TextElementEnumerator.Reset, TextElementEnumerator.MoveNext must be called to advance the enumerator to the first text element of the string before reading the value of TextElementEnumerator.Current.
TextElementEnumerator.Current returns the same object until either TextElementEnumerator.MoveNext or TextElementEnumerator.Reset is called.
After the end of the string is passed, the enumerator is again in an invalid state and calling TextElementEnumerator.MoveNext returns false. Calling TextElementEnumerator.Current throws an exception if the last call to TextElementEnumerator.MoveNext returned false.
public static TextElementEnumerator GetTextElementEnumerator( |
str
index
Exception Type | Condition |
---|---|
ArgumentNullException | str is null. |
ArgumentOutOfRangeException | index is outside the range of valid indexes for str. |
Text element enumerators are intended to be used only to read data in the string. Enumerators cannot be used to modify the underlying string.
The enumerator does not have exclusive access to the string.
When an enumerator is created, it takes a snapshot of the current state of the string. If changes are made to the string, such as adding, modifying or deleting text elements, the snapshot gets out of sync and the enumerator throws an InvalidOperationException. Two enumerators created from the same string at the same time can have different snapshots of the string.
The enumerator is in an invalid state if it is positioned before the first text element in the string or after the last text element in the string. Whenever the enumerator is in an invalid state, calling TextElementEnumerator.Current throws an exception.
Initially, the enumerator is positioned before the first text element in the string. TextElementEnumerator.Reset also brings the enumerator back to this position. Therefore, after an enumerator is created or after a TextElementEnumerator.Reset, TextElementEnumerator.MoveNext must be called to advance the enumerator to the first text element of the string before reading the value of TextElementEnumerator.Current.
TextElementEnumerator.Current returns the same object until either TextElementEnumerator.MoveNext or TextElementEnumerator.Reset is called.
After the end of the string is passed, the enumerator is again in an invalid state and calling TextElementEnumerator.MoveNext returns false. Calling TextElementEnumerator.Current throws an exception if the last call to TextElementEnumerator.MoveNext returned false.
public Type GetType(); |
protected object MemberwiseClone(); |
str
Exception Type | Condition |
---|---|
ArgumentNullException | str is null. |
A control character is a character whose Unicode value is U+007F or in the range U+0000 through U+001F or U+0080 through U+009F.
The .NET Framework defines a text element as a unit of text that is displayed as a single character; that is, a grapheme. A text element can be a base character, a surrogate pair, or a combining character sequence. The Unicode Standard defines a combining character sequence as a combination of a base character and one or more combining characters. A surrogate pair can represent a base character or a combining character. For more information on surrogate pairs and combining character sequences, see The Unicode Standard at http://www.unicode.org.
If a combining character sequence is invalid, every combining character in that sequence is also returned.
Each index in the resulting array is the beginning of a text element; that is, the index of the base character or the high-surrogate.
The length of each element is easily computed as the difference between successive indexes. The length of the array will always be less than or equal to the length of the string. For example, given the string "\u4f00\u302a\ud800\udc00\u4f01", this method would return the indexes 0, 2, and 4.
public virtual string ToString(); |