Function: s-slice-at

s-slice-at is a byte-compiled function defined in s.el.

Signature

(s-slice-at REGEXP S)

Documentation

Slices S up at every index matching REGEXP.

Source Code

;; Defined in ~/.emacs.d/elpa/s-20220902.1511/s.el
(defun s-slice-at (regexp s)
  "Slices S up at every index matching REGEXP."
  (declare (side-effect-free t))
  (if (s-blank? s)
      (list s)
    (let (ss)
      (while (not (s-blank? s))
        (save-match-data
          (let ((i (string-match regexp s 1)))
            (if i
                (setq ss (cons (substring s 0 i) ss)
                      s (substring s i))
              (setq ss (cons s ss)
                    s "")))))
      (nreverse ss))))