Hi,
A very quicky using the most used (by me) string manipulation routines (str2lst and lst2str)
Certainly not the faster one (converting string to an integer list with vl-string->list, manipulating the list and convert it back to a string seems to be the faster way to manipulate string with LISP).
(defun gc:TitleCase (str)
(gc:lst2str
(mapcar '(lambda (x)
(strcat (strcase (substr x 1 1)) (strcase (substr x 2) T))
)
(gc:str2lst str " ")
)
" "
)
)
(defun gc:str2lst (str sep / pos)
(if (setq pos (vl-string-search sep str))
(cons (substr str 1 pos)
(gc:str2lst (substr str (+ (strlen sep) pos 1)) sep)
)
(list str)
)
)
(defun gc:lst2str (lst sep)
(if (cdr lst)
(strcat (car lst) sep (gc:lst2str (cdr lst) sep))
(car lst)
)
)