compare-buffer-substrings

compare-buffer-substrings is a built-in function in `C source code'.

(compare-buffer-substrings BUFFER1 START1 END1 BUFFER2 START2 END2)

Compare two substrings of two buffers; return result as number.
Return -N if first string is less after N-1 chars, +N if first string is
greater after N-1 chars, or 0 if strings match. Each substring is
represented as three arguments: BUFFER, START and END. That makes six
args in all, three for each substring.

The value of `case-fold-search' in the current buffer
determines whether case is significant or ignored.