Early Preview

This is currently very much a preview. Please feel free to try things out, but don't be upset if anything is not yet working. Feedback is welcome over on our GitHub Dicussions page.

class System.​Globalization.​StringInfo

Assembly: System.Runtime

Inheritance: object → StringInfo

Provides functionality to split a string into text elements and to iterate through those text elements.

Properties

public int
LengthInTextElements
Gets the number of text elements in the current <see cref="T:System.Globalization.StringInfo" /> object.
public string
String
Gets or sets the value of the current <see cref="T:System.Globalization.StringInfo" /> object.

Methods

public bool
Equals​(object value)
Indicates whether the current <see cref="T:System.Globalization.StringInfo" /> object is equal to a specified object.
Returns <see langword="true" /> if the <paramref name="value" /> parameter is a <see cref="T:System.Globalization.StringInfo" /> object and its <see cref="P:System.Globalization.StringInfo.String" /> property equals the <see cref="P:System.Globalization.StringInfo.String" /> property of this <see cref="T:System.Globalization.StringInfo" /> object; otherwise, <see langword="false" /> .
value An object.
public int
GetHashCode​()
Calculates a hash code for the value of the current <see cref="T:System.Globalization.StringInfo" /> object.
Returns A 32-bit signed integer hash code based on the string value of this <see cref="T:System.Globalization.StringInfo" /> object.
public static string
GetNextTextElement​(string str)
Gets the first text element in a specified string.
Returns A string containing the first text element in the specified string.
str The string from which to get the text element.
public static string
GetNextTextElement​(string str, int index)
Gets the text element at the specified index of the specified string.
Returns A string containing the text element at the specified index of the specified string.
str The string from which to get the text element.
index The zero-based index at which the text element starts.
public static int
GetNextTextElementLength​(ReadOnlySpan<​char> str)
Returns the length of the first text element (extended grapheme cluster) that occurs in the input span.
Returns The length (in chars) of the substring corresponding to the first text element within <paramref name="str" /> , or 0 if <paramref name="str" /> is empty.
str The input span to analyze.
public static int
GetNextTextElementLength​(string str)
Returns the length of the first text element (extended grapheme cluster) that occurs in the input string.
Returns The length (in chars) of the substring corresponding to the first text element within <paramref name="str" /> , or 0 if <paramref name="str" /> is empty.
str The input string to analyze.
public static int
GetNextTextElementLength​(string str, int index)
Returns the length of the first text element (extended grapheme cluster) that occurs in the input string starting at the specified index.
Returns The length (in chars) of the substring corresponding to the first text element within <paramref name="str" /> starting at index <paramref name="index" /> , or 0 if <paramref name="index" /> corresponds to the end of <paramref name="str" /> .
str The input string to analyze.
index The char offset in <paramref name="str" /> at which to begin analysis.
public static TextElementEnumerator
GetTextElementEnumerator​(string str)
Returns an enumerator that iterates through the text elements of the entire string.
Returns A <see cref="T:System.Globalization.TextElementEnumerator" /> for the entire string.
str The string to iterate through.
public static TextElementEnumerator
GetTextElementEnumerator​(string str, int index)
Returns an enumerator that iterates through the text elements of the string, starting at the specified index.
Returns A <see cref="T:System.Globalization.TextElementEnumerator" /> for the string starting at <paramref name="index" /> .
str The string to iterate through.
index The zero-based index at which to start iterating.
public static int[]
ParseCombiningCharacters​(string str)
Returns the indexes of each base character, high surrogate, or control character within the specified string.
Returns An array of integers that contains the zero-based indexes of each base character, high surrogate, or control character within the specified string.
str The string to search.
public string
SubstringByTextElements​(int startingTextElement)
Retrieves a substring of text elements from the current <see cref="T:System.Globalization.StringInfo" /> object starting from a specified text element and continuing through the last text element.
Returns A substring of text elements in this <see cref="T:System.Globalization.StringInfo" /> object, starting from the text element index specified by the <paramref name="startingTextElement" /> parameter and continuing through the last text element in this object.
startingTextElement The zero-based index of a text element in this <see cref="T:System.Globalization.StringInfo" /> object.
public string
SubstringByTextElements​(int startingTextElement, int lengthInTextElements)
Retrieves a substring of text elements from the current <see cref="T:System.Globalization.StringInfo" /> object starting from a specified text element and continuing through the specified number of text elements.
Returns A substring of text elements in this <see cref="T:System.Globalization.StringInfo" /> object. The substring consists of the number of text elements specified by the <paramref name="lengthInTextElements" /> parameter and starts from the text element index specified by the <paramref name="startingTextElement" /> parameter.
startingTextElement The zero-based index of a text element in this <see cref="T:System.Globalization.StringInfo" /> object.
lengthInTextElements The number of text elements to retrieve.
protected void
Finalize​()
Inherited from object
Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection.
public Type
GetType​()
Inherited from object
Gets the <see cref="T:System.Type" /> of the current instance.
Returns The exact runtime type of the current instance.
protected object
MemberwiseClone​()
Inherited from object
Creates a shallow copy of the current <see cref="T:System.Object" /> .
Returns A shallow copy of the current <see cref="T:System.Object" /> .
public string
ToString​()
Inherited from object
Returns a string that represents the current object.
Returns A string that represents the current object.