ReorderCanonical() static private method

static private ReorderCanonical ( string src, StringBuilder &sb, int start ) : void
src string
sb StringBuilder
start int
return void
コード例 #1
0
 private static void ReorderCanonical(string src, ref StringBuilder sb, int start)
 {
     if (sb == null)
     {
         for (int i = 1; i < src.Length; i++)
         {
             int num = (int)Normalization.GetCombiningClass((int)src[i]);
             if (num != 0)
             {
                 if ((int)Normalization.GetCombiningClass((int)src[i - 1]) > num)
                 {
                     sb = new StringBuilder(src.Length);
                     sb.Append(src, 0, src.Length);
                     Normalization.ReorderCanonical(src, ref sb, i);
                     return;
                 }
             }
         }
         return;
     }
     for (int j = start; j < sb.Length; j++)
     {
         int num2 = (int)Normalization.GetCombiningClass((int)sb[j]);
         if (num2 != 0)
         {
             if ((int)Normalization.GetCombiningClass((int)sb[j - 1]) > num2)
             {
                 char value = sb[j - 1];
                 sb[j - 1] = sb[j];
                 sb[j]     = value;
                 j--;
             }
         }
     }
 }
コード例 #2
0
        private static void Decompose(string source, ref StringBuilder sb, int checkType)
        {
            int[] array = null;
            int   num   = 0;

            for (int i = 0; i < source.Length; i++)
            {
                if (Normalization.QuickCheck(source[i], checkType) == NormalizationCheck.No)
                {
                    Normalization.DecomposeChar(ref sb, ref array, source, i, ref num);
                }
            }
            if (sb != null)
            {
                sb.Append(source, num, source.Length - num);
            }
            Normalization.ReorderCanonical(source, ref sb, 1);
        }