public static TextElementEnumerator GetTextElementEnumerator(String str, int index) { // // Validate parameters. // if (str==null) { throw new ArgumentNullException("str"); } int len = str.Length; if (index < 0 || (index > len)) { throw new ArgumentOutOfRangeException("index", Environment.GetResourceString("ArgumentOutOfRange_Index")); } return (new TextElementEnumerator(str, index, len)); }
/// <summary>Returns the indexes of each base character, high surrogate, or control character within the specified string.</summary> /// <returns>An array of integers that contains the zero-based indexes of each base character, high surrogate, or control character within the specified string.</returns> /// <param name="str">The string to search. </param> /// <exception cref="T:System.ArgumentNullException"> /// <paramref name="str" /> is null. </exception> public static int[] ParseCombiningCharacters(string str) { if (str == null) { throw new ArgumentNullException("string is null"); } ArrayList arrayList = new ArrayList(str.Length); TextElementEnumerator textElementEnumerator = StringInfo.GetTextElementEnumerator(str); textElementEnumerator.Reset(); while (textElementEnumerator.MoveNext()) { arrayList.Add(textElementEnumerator.ElementIndex); } return((int[])arrayList.ToArray(typeof(int))); }