What happend with princ function in that code, if you use sample 1 is OK but with sample 2 it can not use.
sample 1
; idea from Josh
(defun comma (a / b d e f g)
(setq b (fix a))
(setq d (itoa b))
(setq e (strlen d))
(setq f "")
(setq g "")
(while
(> e 3)
(setq f (strcat "," (substr d (- e 2)) f))
(setq d (substr d 1 (- e 3)))
(setq e (- e 3))
) ; while
(setq f (strcat d f g))
) ; defun
(comma 123498)
sample 2
; idea from Josh
(defun comma (a / b d e f g)
(setq b (fix a))
(setq d (itoa b))
(setq e (strlen d))
(setq f "")
(setq g "")
(while
(> e 3)
(setq f (strcat "," (substr d (- e 2)) f))
(setq d (substr d 1 (- e 3)))
(setq e (- e 3))
) ; while
(setq f (strcat d f g))
(princ)
) ; defun
(comma 123498)