Example #1
0
        private static bool StartsWithRtlCharacter(StringSlice slice)
        {
            for (int i = slice.Start; i <= slice.End; i++)
            {
                if (slice[i] < 128)
                {
                    continue;
                }

                int rune;
                if (CharHelper.IsHighSurrogate(slice[i]) && i < slice.End && CharHelper.IsLowSurrogate(slice[i + 1]))
                {
                    Debug.Assert(char.IsSurrogatePair(slice[i], slice[i + 1]));
                    rune = char.ConvertToUtf32(slice[i], slice[i + 1]);
                }
                else
                {
                    rune = slice[i];
                }

                if (CharHelper.IsRightToLeft(rune))
                {
                    return(true);
                }

                if (CharHelper.IsLeftToRight(rune))
                {
                    return(false);
                }
            }

            return(false);
        }
 public static bool IsNameStartChar(char c, char d)
 {
     if (CharHelper.IsHighSurrogate(c) && CharHelper.IsLowSurrogate(d))
     {
         int codepoint = CharHelper.ConvertToUtf32(c, d);
         return(codepoint >= 0x10000 && codepoint <= 0xeffff);
     }
     else
     {
         return(false);
     }
 }