GetTextElementEnumerator() public static méthode

public static GetTextElementEnumerator ( String str ) : TextElementEnumerator
str String
Résultat TextElementEnumerator
Exemple #1
0
        /// <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)));
        }
Exemple #2
0
 public static TextElementEnumerator GetTextElementEnumerator(string str)
 {
     return(StringInfo.GetTextElementEnumerator(str, 0));
 }