System.Globalization.StringInfo.GetNextTextElement C# (CSharp) Метод

GetNextTextElement() публичный статический Метод

public static GetNextTextElement ( String str, int index ) : String
str String
index int
Результат String
        public static String GetNextTextElement(String str, int index) {
            //
            // Validate parameters.
            //
            if (str==null) {
                throw new ArgumentNullException("str");
            }
        
            int len = str.Length;
            if (index < 0 || index >= len) {
                if (index == len) {
                    return (String.Empty);
                }            
                throw new ArgumentOutOfRangeException("index", Environment.GetResourceString("ArgumentOutOfRange_Index"));
            }

            int charLen;
            UnicodeCategory uc = CharUnicodeInfo.InternalGetUnicodeCategory(str, index, out charLen);
            return (str.Substring(index, GetCurrentTextElementLen(str, index, len, ref uc, ref charLen)));
        }

Same methods

StringInfo::GetNextTextElement ( String str ) : String

Usage Example

Пример #1
0
 /// <summary>Gets the first text element in a specified string.</summary>
 /// <returns>A string containing the first text element in the specified string.</returns>
 /// <param name="str">The string from which to get the text element. </param>
 /// <exception cref="T:System.ArgumentNullException">
 ///   <paramref name="str" /> is null. </exception>
 public static string GetNextTextElement(string str)
 {
     if (str == null || str.Length == 0)
     {
         throw new ArgumentNullException("string is null");
     }
     return(StringInfo.GetNextTextElement(str, 0));
 }
All Usage Examples Of System.Globalization.StringInfo::GetNextTextElement