Function: s-truncate
s-truncate is a byte-compiled function defined in s.el.
Signature
(s-truncate LEN S &optional ELLIPSIS)
Documentation
If S is longer than LEN, cut it down and add ELLIPSIS to the end.
The resulting string, including ellipsis, will be LEN characters long.
When not specified, ELLIPSIS defaults to ‘...’.
Source Code
;; Defined in ~/.emacs.d/elpa/s-20220902.1511/s.el
(defun s-truncate (len s &optional ellipsis)
"If S is longer than LEN, cut it down and add ELLIPSIS to the end.
The resulting string, including ellipsis, will be LEN characters
long.
When not specified, ELLIPSIS defaults to ‘...’."
(declare (pure t) (side-effect-free t))
(unless ellipsis
(setq ellipsis "..."))
(if (> (length s) len)
(format "%s%s" (substring s 0 (- len (length ellipsis))) ellipsis)
s))