System.Globalization.StringInfo Class

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

See Also: StringInfo Members


public class StringInfo


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 tp:// defines a surrogate pair as a coded character representation for a single abstract character that consists of a sequence of two code units, where the first unit of the pair is a high surrogate and the second is a low surrogate. 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.

The System.Globalization.StringInfo class enables you to work with a string as a series of textual elements rather than individual char objects. You can work with the individual text elements in a string in two ways:

The following example illustrates both ways of working with the text elements in a string. It creates two strings:

Each string is parsed once by the StringInfo.ParseCombiningCharacters(string) method and then by the StringInfo.GetTextElementEnumerator(string) method. Both methods correctly parse the text elements in the two strings and display the results of the parsing operation.

code reference: System.Globalization.StringInfo.Class#1


Namespace: System.Globalization
Assembly: mscorlib (in mscorlib.dll)
Assembly Versions: 1.0.5000.0,,