Function: lv--pad-to-center

lv--pad-to-center is a byte-compiled function defined in lv.el.

Signature

(lv--pad-to-center STR WIDTH)

Documentation

Pad STR with spaces on the left to be centered to WIDTH.

Source Code

;; Defined in ~/.emacs.d/elpa/lv-20200507.1518/lv.el
(defun lv--pad-to-center (str width)
  "Pad STR with spaces on the left to be centered to WIDTH."
  (let* ((strs (split-string str "\n"))
         (padding (make-string
                   (/ (- width (length (car strs))) 2)
                   ?\ )))
    (mapconcat (lambda (s) (concat padding s)) strs "\n")))