bidi-find-overridden-directionality

bidi-find-overridden-directionality is a built-in function in `C source code'.

(bidi-find-overridden-directionality FROM TO &optional OBJECT)

Return position between FROM and TO where directionality was overridden.

This function returns the first character position in the specified
region of OBJECT where there is a character whose `bidi-class' property
is `L', but which was forced to display as `R' by a directional
override, and likewise with characters whose `bidi-class' is `R'
or `AL' that were forced to display as `L'.

If no such character is found, the function returns nil.

OBJECT is a Lisp string or buffer to search for overridden
directionality, and defaults to the current buffer if nil or omitted.
OBJECT can also be a window, in which case the function will search
the buffer displayed in that window. Passing the window instead of
a buffer is preferable when the buffer is displayed in some window,
because this function will then be able to correctly account for
window-specific overlays, which can affect the results.

Strong directional characters `L', `R', and `AL' can have their
intrinsic directionality overridden by directional override
control characters RLO (u+202e) and LRO (u+202d). See the
function `get-char-code-property' for a way to inquire about
the `bidi-class' property of a character.