private static bool StartsWithRtlCharacter(StringSlice slice) { for (int i = slice.Start; i <= slice.End; i++) { char c = slice[i]; if (c < 128) { if (CharHelper.IsAlpha(c)) { return(false); } continue; } int rune = c; if (CharHelper.IsHighSurrogate(c) && i < slice.End && CharHelper.IsLowSurrogate(slice[i + 1])) { Debug.Assert(char.IsSurrogatePair(c, slice[i + 1])); rune = char.ConvertToUtf32(c, slice[i + 1]); i++; } if (CharHelper.IsRightToLeft(rune)) { return(true); } if (CharHelper.IsLeftToRight(rune)) { return(false); } } return(false); }