help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Creating string from list of strings


From: Bill Wohler
Subject: Creating string from list of strings
Date: Mon, 14 Oct 2002 06:26:11 GMT
User-agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.2

  I wasn't able to figure out from the Elisp manual how to turn a list
  of strings into a single string. For example, how does one
  print the following list of strings?

    (setq list-of-strings '("foo" "bar"))
    (message (perform-magic-with list-of-strings))

  While the following works, it seems that there should be a one-liner
  to do this already:

    (defvar my-string)
    (while list-of-strings
      (setq my-string (concat my-string (car list-of-strings)))
      (setq list-of-strings (cdr list-of-strings)))
    (message (my-string))

-- 
Bill Wohler <wohler@newt.com>  http://www.newt.com/wohler/  GnuPG ID:610BD9AD
Maintainer of comp.mail.mh FAQ and mh-e. Vote Libertarian!
If you're passed on the right, you're in the wrong lane.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]