Function: dtrt-indent--replace-in-string

dtrt-indent--replace-in-string is a natively compiled function defined in dtrt-indent.el.

Signature

(dtrt-indent--replace-in-string HAYSTACK NEEDLE-REGEXP REPLACEMENT)

Documentation

Replace every match in string by constant replacement.

Returns HAYSTACK with every match of NEEDLE-REGEXP replaced by REPLACEMENT.

Source Code

;; Defined in /nix/store/xl774j723v677bsfsybzln3vi6w0fpm3-emacs-packages-deps/share/emacs/site-lisp/elpa/dtrt-indent-20260709.2011/dtrt-indent.el
(defun dtrt-indent--replace-in-string (haystack
                                       needle-regexp
                                       replacement)
  "Replace every match in string by constant replacement.
Returns HAYSTACK with every match of NEEDLE-REGEXP replaced by
REPLACEMENT."
  (if (string-match needle-regexp haystack)
      (concat (substring haystack 0 (match-beginning 0))
              replacement
              (substring haystack (match-end 0)))
    haystack))