[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
RE: What's the best way to do "string-memq"?
From: |
Drew Adams |
Subject: |
RE: What's the best way to do "string-memq"? |
Date: |
Mon, 10 Nov 2008 11:00:55 -0800 |
> > (string-match (regexp-quote
> > (char-to-string (char-after)))
> > skip-chars)
>
> > (member (char-after) (string-to-list skip-chars))
>
> The non-nil isn't a problem at all.
>
> But thanks for the tip! I probably won't want to use
> `string-to-list', since it's in mule, and mule wasn't
> included as standard in some previous Emacs, (Was it 20 or 21?).
`string-to-list' is available in emacs -Q for both Emacs 20 and 21.
That said, you might well not want to create a list here.
> But string-to-list is nothing more than:
>
> (defsubst string-to-list (string)
> "Return a list of characters in STRING."
> (append string nil))
>
> , so I think I can use `append' directly. But what a kludge it is!
>
> (append "asdf" "1234!) => (?a ?s ?d ?f "1234)
>
> . It's almost embarrassing. ;-(
>
> Thanks again! This list always comes up with the goods.
`append' with a nil second arg is a typical way to convert sequences (such as
strings and vectors) to lists.