GetCurrentTextElementLen() static private method

static private GetCurrentTextElementLen ( String str, int index, int len, UnicodeCategory &ucCurrent, int &currentCharCount ) : int
str String
index int
len int
ucCurrent UnicodeCategory
currentCharCount int
return int
コード例 #1
0
        public static int[] ParseCombiningCharacters(string str)
        {
            if (str == null)
            {
                throw new ArgumentNullException("str");
            }
            int length = str.Length;

            int[] array = new int[length];
            if (length == 0)
            {
                return(array);
            }
            int             num = 0;
            int             i   = 0;
            int             num2;
            UnicodeCategory unicodeCategory = CharUnicodeInfo.InternalGetUnicodeCategory(str, 0, out num2);

            while (i < length)
            {
                array[num++] = i;
                i           += StringInfo.GetCurrentTextElementLen(str, i, length, ref unicodeCategory, ref num2);
            }
            if (num < length)
            {
                int[] array2 = new int[num];
                Array.Copy(array, array2, num);
                return(array2);
            }
            return(array);
        }
コード例 #2
0
        public static int[] ParseCombiningCharacters(string str)
        {
            if (str == null)
            {
                throw new ArgumentNullException("str");
            }
            int length1 = str.Length;

            int[] numArray1 = new int[length1];
            if (length1 == 0)
            {
                return(numArray1);
            }
            int             length2 = 0;
            int             index   = 0;
            int             charLength;
            UnicodeCategory unicodeCategory = CharUnicodeInfo.InternalGetUnicodeCategory(str, 0, out charLength);

            while (index < length1)
            {
                numArray1[length2++] = index;
                index += StringInfo.GetCurrentTextElementLen(str, index, length1, ref unicodeCategory, ref charLength);
            }
            if (length2 >= length1)
            {
                return(numArray1);
            }
            int[] numArray2 = new int[length2];
            Array.Copy((Array)numArray1, (Array)numArray2, length2);
            return(numArray2);
        }
コード例 #3
0
 public bool MoveNext()
 {
     if (this.index >= this.strLen)
     {
         this.index = this.strLen + 1;
         return(false);
     }
     this.currTextElementLen = StringInfo.GetCurrentTextElementLen(this.str, this.index, this.strLen, ref this.uc, ref this.charLen);
     this.index = this.index + this.currTextElementLen;
     return(true);
 }
コード例 #4
0
 public bool MoveNext()
 {
     if (_index >= _strLen)
     {
         // Make the _index to be greater than _strLen so that we can throw exception if GetTextElement() is called.
         _index = _strLen + 1;
         return(false);
     }
     _currTextElementLen = StringInfo.GetCurrentTextElementLen(_str, _index, _strLen, ref _uc, ref _charLen);
     _index += _currTextElementLen;
     return(true);
 }
コード例 #5
0
 public bool MoveNext()
 {
     if (index >= strLen)
     {
         // Make the index to be greater than strLen so that we can throw exception if GetTextElement() is called.
         index = strLen + 1;
         return(false);
     }
     currTextElementLen = StringInfo.GetCurrentTextElementLen(str, index, strLen, ref uc, ref charLen);
     index += currTextElementLen;
     return(true);
 }
コード例 #6
0
        public static string GetNextTextElement(string str, int index)
        {
            if (str == null)
            {
                throw new ArgumentNullException("str");
            }
            int length = str.Length;

            if (index >= 0 && index < length)
            {
                int             num;
                UnicodeCategory unicodeCategory = CharUnicodeInfo.InternalGetUnicodeCategory(str, index, out num);
                return(str.Substring(index, StringInfo.GetCurrentTextElementLen(str, index, length, ref unicodeCategory, ref num)));
            }
            if (index == length)
            {
                return(string.Empty);
            }
            throw new ArgumentOutOfRangeException("index", Environment.GetResourceString("ArgumentOutOfRange_Index"));
        }