Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Emacs-Lisp: removing a char from a string

0 views
Skip to first unread message

J-P Theberge

unread,
Feb 9, 2000, 3:00:00 AM2/9/00
to

Hi,

I want to define a function (strip-char-from-string CHAR STRING)

ex: (strip-char-from-string 97 "FooBar") => "FooBr"

Maybe I'm stupid but I can't find a simple way to do it...
(or maybe the function already exists but I cant find it?)

Any help?


A not working attempt:

(map 'string
(lambda (x)
(if (not (eq x char)) x 0))
string)

Thanks!

-jp

Eric Marsden

unread,
Feb 9, 2000, 3:00:00 AM2/9/00
to
>>>>> "jpt" == J-P Theberge <jp...@act.oda.fr> writes:

jpt> I want to define a function (strip-char-from-string CHAR STRING)
jpt>
jpt> ex: (strip-char-from-string 97 "FooBar") => "FooBr"

(require 'cl)
(remove ?a "FooBar")

--
Eric Marsden

Marco Antoniotti

unread,
Feb 10, 2000, 3:00:00 AM2/10/00
to

Eric Marsden <emar...@mail.dotcom.fr> writes:

Ah ah! You just used (require 'cl) :)

Cheers

--
Marco Antoniotti ===========================================
PARADES, Via San Pantaleo 66, I-00186 Rome, ITALY
tel. +39 - 06 68 10 03 17, fax. +39 - 06 68 80 79 26
http://www.parades.rm.cnr.it/~marcoxa

J-P Theberge

unread,
Feb 10, 2000, 3:00:00 AM2/10/00
to
Marco Antoniotti <mar...@parades.rm.cnr.it> writes:

> Eric Marsden <emar...@mail.dotcom.fr> writes:
>
> > >>>>> "jpt" == J-P Theberge <jp...@act.oda.fr> writes:
> >
> > jpt> I want to define a function (strip-char-from-string CHAR STRING)
> > jpt>
> > jpt> ex: (strip-char-from-string 97 "FooBar") => "FooBr"
> >
> > (require 'cl)
> > (remove ?a "FooBar")
>
> Ah ah! You just used (require 'cl) :)
>

I would be great if the emacs lisp manual include functions from other
standart package like cl.

(I know complaining here is not the right way for this to happen
but my english & emacslisp skills are not good enought to do it myself)

-jp

Gareth Rees

unread,
Feb 10, 2000, 3:00:00 AM2/10/00
to
J-P Theberge <jp...@act.oda.fr> wrote:
> I would be great if the emacs lisp manual include functions from other
> standard package like cl.

The cl package comes with its own Info documentation, which is included
in the Emacs distribution (unlike the Emacs Lisp manual). See the Info
node (cl)Top.

--
Gareth Rees

Eli Zaretskii

unread,
Feb 11, 2000, 3:00:00 AM2/11/00
to
J-P Theberge wrote:
>
> > > (require 'cl)
> > > (remove ?a "FooBar")
> >
> > Ah ah! You just used (require 'cl) :)
> >
>
> I would be great if the emacs lisp manual include functions from other
> standart package like cl.

It already does: you should have the file "cl" in your info subdirectory.
Type "C-h i", then "g (cl) RET", and you will be reading it. I can find the
description of the `remove' function if I press "i remove RET".

0 new messages