Csharp/C Sharp by API/System.Globalization/StringInfo
StringInfo.GetNextTextElement
<source lang="csharp"> using System; using System.Globalization; using System.Threading; class Class1 {
static void Main(string[] args) { String MyStr, OutBuf; MyStr = "The Quick programmer ran rings around the lazy manager"; for (int k=0; k<MyStr.Length; k++) { OutBuf = "Character at position " + k.ToString() + " = " + StringInfo.GetNextTextElement(MyStr, k); Console.WriteLine(OutBuf); } }
}
</source>
StringInfo.GetTextElementEnumerator
<source lang="csharp"> using System; using System.Globalization; using System.Threading; class Class1 {
static void Main(string[] args) { TextElementEnumerator Iter; String MyStr, OutBuf; MyStr = "The Quick programmer ran rings around the lazy manager"; //Lets do the iterator thing Iter = StringInfo.GetTextElementEnumerator(MyStr); while (Iter.MoveNext()) { OutBuf = "Character at position " + Iter.ElementIndex.ToString() + " = " + Iter.Current; Console.WriteLine(OutBuf); } }
}
</source>