From: kai.grossjohann@uni-duisburg.de (Kai Großjohann)
Subject: Re: looping over characters in a string in elisp?
Date: Thu, 26 Dec 2002 16:50:50 +0100 [thread overview]
Message-ID: <84bs38hj8l.fsf@lucy.cs.uni-dortmund.de> (raw)
In-Reply-To: roy-722F9F.18535425122002@reader1.panix.com
Roy Smith <roy@panix.com> writes:
> I'm probably being dense, but I can't figure out how to loop over each
> character in a string in elisp (I'm using emacs 20.5.1). I know I can
> use mapchar to map a function to each character, but I'm looking for
> something that lets me do (essentially):
>
> (while char in string
> (do stuff)
> )
Why does it have to be a while loop? Why is a map-like look not
enough?
(mapcar (lambda (c) (char-to-string c)) "foobar")
This calls the lambda expression on each character and collects the
results in a list. You can throw the result away if you don't like
it...
--
Do not be ashamed of ambibibentism.
next prev parent reply other threads:[~2002-12-26 15:50 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2002-12-25 23:53 looping over characters in a string in elisp? Roy Smith
2002-12-26 0:32 ` Jesper Harder
2002-12-26 15:50 ` Kai Großjohann [this message]
2002-12-29 0:33 ` Ian Zimmerman
2002-12-29 11:37 ` Kai Großjohann
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=84bs38hj8l.fsf@lucy.cs.uni-dortmund.de \
--to=kai.grossjohann@uni-duisburg.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.