;; Breaks a string at spaces (if possible) into a list of ;;
;; substrings of a specified length or less. ;;
;;------------------------------------------------------------;;
;; Author: Lee Mac, Copyright © 2011 - www.lee-mac.com ;;
;;------------------------------------------------------------;;
;; Arguments: ;;
;; str - String to wrap to a specific length ;;
;; len - Maximum length of each substring ;;
;;------------------------------------------------------------;;
;; Returns: List of substrings of specified length or less ;;
;;------------------------------------------------------------;;
(defun LM:StringWrap
( str len
/ pos
) )
)
(LM:StringWrap
(substr str
(+ 2 pos
)) len
) )
)
)
(LM:StringWrap "This is a very long string which needs to be wrapped." 20)
("This is a very long" "string which needs" "to be wrapped.")