Function: calculator-groupize-number
calculator-groupize-number is a byte-compiled function defined in
calculator.el.gz.
Signature
(calculator-groupize-number STR N SEP &optional FROMLEFT)
Documentation
Return the input string STR with occurrences of SEP that separate every N characters starting from the right, or from the left if FROMLEFT is true.
Source Code
;; Defined in /usr/src/emacs/lisp/calculator.el.gz
(defun calculator-groupize-number (str n sep &optional fromleft)
"Return the input string STR with occurrences of SEP that separate
every N characters starting from the right, or from the left if
FROMLEFT is true."
(let* ((len (length str)) (i (/ len n)) (j (% len n))
(r (if (or (not fromleft) (= j 0)) '()
(list (substring str (- len j))))))
(while (> i 0)
(let* ((e (* i n)) (e (if fromleft e (+ e j))))
(push (substring str (- e n) e) r))
(setq i (1- i)))
(when (and (not fromleft) (> j 0))
(push (substring str 0 j) r))
(mapconcat 'identity r sep)))