System.Globalization.StringInfo.GetTextElementEnumerator C# (CSharp) Méthode

GetTextElementEnumerator() public static méthode

public static GetTextElementEnumerator ( String str, int index ) : TextElementEnumerator
str String
index int
Résultat TextElementEnumerator
        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));
        }

Same methods

StringInfo::GetTextElementEnumerator ( String str ) : TextElementEnumerator

Usage Example

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)));
        }
All Usage Examples Of System.Globalization.StringInfo::GetTextElementEnumerator