Have at it. Hope it helped. However, you need not credit me on this as the only thing you used of mine was my function name. lol
I thought I'd post a couple examples of your desired result.
Both are recursive, but the second uses list over string manipulation as it's just faster (not that it's going to make much of a difference on something like this.
(defun _numPad (str len)
((lambda (foo)
(if (wcmatch str "-*")
(strcat "-" (foo (substr str 2) len))
(foo str len)
)
)
(lambda (n l)
(if (< (strlen n) l)
(foo (strcat "0" n) l)
n
)
)
)
)
(defun _numPad2 (str len)
((lambda (foo lst)
(vl-list->string (if (eq (car lst) 45)
(cons 45 (foo (cdr lst) len))
(foo lst len)
)
)
)
(lambda (x l)
(if (< (length x) l)
(foo (cons 48 x) l)
x
)
)
(vl-string->list str)
)
)