Function: s-shared-start

s-shared-start is a byte-compiled function defined in s.el.

Signature

(s-shared-start S1 S2)

Documentation

Returns the longest prefix S1 and S2 have in common.

Source Code

;; Defined in ~/.emacs.d/elpa/s-20220902.1511/s.el
(defun s-shared-start (s1 s2)
  "Returns the longest prefix S1 and S2 have in common."
  (declare (pure t) (side-effect-free t))
  (let ((cmp (compare-strings s1 0 (length s1) s2 0 (length s2))))
    (if (eq cmp t) s1 (substring s1 0 (1- (abs cmp))))))