unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: David Kastrup <dak@gnu.org>
Subject: Re: removing spaces from a string
Date: Wed, 19 Apr 2006 13:42:00 +0200	[thread overview]
Message-ID: <851wvtiygn.fsf@lola.goethe.zz> (raw)
In-Reply-To: 19il38twme189$.1ey704zs7hwp8$.dlg@40tude.net

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	other threads:[~2006-04-19 11:42 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <mailman.561.1145441329.9609.help-gnu-emacs@gnu.org>
2006-04-19 10:43 ` removing spaces from a string Peter Tury
2006-04-19 11:42   ` David Kastrup [this message]
2006-04-19 12:49     ` Pascal Bourguignon
2006-04-19 13:11       ` David Kastrup
2006-04-19 15:06       ` Peter Tury
2006-04-19 15:39         ` Giorgos Keramidas
2006-04-19 16:02           ` Peter Tury
2006-04-19 19:30         ` Pascal Bourguignon
2006-04-19 17:30   ` Eli Zaretskii
2006-04-19 10:01 LENNART BORGMAN
  -- strict thread matches above, loose matches on Subject: below --
2006-04-19  9:02 Peter Tury

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

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=851wvtiygn.fsf@lola.goethe.zz \
    --to=dak@gnu.org \
    /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.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).