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); }
private bool StartsWithRtlCharacter(StringSlice slice) { foreach (var c in CharHelper.ToUtf32(slice)) { if (CharHelper.IsRightToLeft(c)) { return(true); } else if (CharHelper.IsLeftToRight(c)) { return(false); } } return(false); }