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

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

Re: removing spaces from a string


From: David Kastrup
Subject: Re: removing spaces from a string
Date: Wed, 19 Apr 2006 13:42:00 +0200
User-agent: Gnus/5.11 (Gnus v5.11) Emacs/22.0.50 (gnu/linux)

Peter Tury <tury.peter@gmail.com> writes:

> On Wed, 19 Apr 2006 12:01:21 +0200, LENNART BORGMAN wrote:
>
>> From: Peter Tury <tury.peter@gmail.com>
>> Date: Wednesday, April 19, 2006 11:02 am
>> Subject: removing spaces from a string
>> 
>>> Hi,
>>> 
>>> how can I most simply remove all spaces from a string? I plan to 
>>> have a
>>> variable what holds the string, so functions what operates on regions,
>>> rectangles or any parts of a buffer, etc. are not good (I guess).
>>> 
>>> I would need something like this: (remove-all-space a-sting-var); 
>>> if e.g.
>>> (setq a-string-var "abcd ef   dg ") then this should return 
>>> "abcdefdg" what
>>> I will pass forward to another function (namely: process-send-string).
>>> 
>>> Thanks!
>>> P
>>> 
>> 
>> Maybe use replace-regexp-in-string?
>
> Thanks! I looked exactly for this one. Unfortunately I couldn't find it
> (using C-h a ..., and browsing the emacs and elisp manuals... -- now I see
> I should have used C-h d ...?)

It is also possible to do
(concat (delq ?\  (append "This is a string" nil)))

Or a number of other approaches.

-- 
David Kastrup, Kriemhildstr. 15, 44793 Bochum


reply via email to

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