s-news
[Top] [All Lists]

Re: Removing extra white space

To: maeve.harrison9@mail.dcu.ie
Subject: Re: Removing extra white space
From: David L Lorenz <lorenz@usgs.gov>
Date: Wed, 20 Jun 2007 08:49:27 -0500
Cc: s-news@lists.biostat.wustl.edu, s-news-owner@lists.biostat.wustl.edu
In-reply-to: <462C66080003E0BE@hawk.dcu.ie>

Maeve,
  The Hmisc library has a function that will replace multiple interior spaces with a single space. The function is sedit().

sedit("name    with        spaces", '  ', ' ') # replace all occurrences of double space with a single space
[1] "name with spaces"

  It is not clear for the documentation that this will work, but it does.
Dave


maeve.harrison9@mail.dcu.ie
Sent by: s-news-owner@lists.biostat.wustl.edu

06/20/2007 08:14 AM

To
s-news@lists.biostat.wustl.edu
cc
Subject
[S] Removing extra white space





Hi

I am using S-Plus 6.2 on Windows NT and I am trying to remove extra white
spaces from a string.
I have used the strip.blanks() method to remove leading and trailing white
space, but I also want a function that will remove extra interior white spaces,
where "name    with        spaces" would be changed to "name with spaces",
with only one space between the words.


Thanks in anticipation for any help,
Maeve


--------------------------------------------------------------------
This message was distributed by s-news@lists.biostat.wustl.edu.  To
unsubscribe send e-mail to s-news-request@lists.biostat.wustl.edu with
the BODY of the message:  unsubscribe s-news

<Prev in Thread] Current Thread [Next in Thread>