- Code: Select all
(length 1234567890)
would equal 10, or:
- Code: Select all
(length 5487)
would equal 4
(length 1234567890)
(length 5487)
(defun number-length (num)
(if (zerop num)
1
(1+ (floor (log num 10)))))
(defun number-length (num)
(length (format nil "~s" num)))
Users browsing this forum: Google [Bot], Yahoo [Bot] and 2 guests