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)));
}