I didn't see the "straight forward" method, so I thought I'd add that (I only glanced at a few of the other offerings so if this method has already been offered, I apologize). The following will just search through a string looking for spaces (this simple method will not work in all cases--like: " 1 @ What you see..." or recognize only chars--but for simple strings/situations, will work fine).
This is a simple loop method that uses only the base autolisp functions (should work in other platforms like OSX and in scripting) but as I stated above is not fool proof like others shown.
(defun find
-acronym
(aString
/ maxlength counter out
) ;; This function will iterate a string and assemble an acronym of the first
;; letter from each word.
;;
;; This function assumes that each word is separated by spaces.
;;
;; PARAMS:
;; aString - A String to search.
;;
;; Returns:
;; a string
(setq maxlength
(strlen aString
) ; -establish length of input string counter 1 ; -start a counter
out
(substr aString counter
1) ; -establish a output string (assume the first char ; is correct).
; NOTE: This is a potential problem (here be dragons);
; We are not "searching/finding" the first char.
) ; setq
(while (< counter maxlength
) ; -process string one chr at a time (if (= " " (substr aString counter
1)) ; -look for the spaces (setq out
; -if we have a space, concat the output ; with the next char in the string.
) ; if
(setq counter
(1+ counter
)) ; -increment the counterer ) ; while
out ; -return the output string.
)