[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
string-strip
From: |
Andreas Roehler |
Subject: |
string-strip |
Date: |
Fri, 16 Jun 2006 10:07:14 +0200 |
User-agent: |
Thunderbird 1.5.0.4 (X11/20060516) |
Hi,
quite often I need a function to correct user-input,
i.e. wrongly inserted white spaces.
Used `comment-string-strip' to that purpose, which
works fine so far. However, there are two problems with
it:
- it's rather difficult to use, as its requires
handling of three arguments, where just one would
sufficient in the cases I need it.
- it's in newcomment.el, used for a special purpose
there and may be changed. So I hesitate to
make programs depend on them.
What about to introduce a simplified version of `comment-string-strip'
into subr.el - if it's not already somewhere?
(defun my-string-strip (str)
"Strip STR of any leading (if BEFOREP) and/or trailing (if AFTERP) space."
(string-match "\\`\\s-*\\(.*?\\)\\s-*\n?\\'" str)
(match-string 1 str))
(string-strip "asdf ")"asdf"
(string-strip " asdf")"asdf"
(string-strip " asdf ")"asdf"
__
Andreas Roehler
- string-strip,
Andreas Roehler <=
- Re: string-strip, Richard Stallman, 2006/06/19
- Re: string-strip, Lars Hansen, 2006/06/19
- Re: string-strip, Richard Stallman, 2006/06/19
- Re: string-strip, Lars Hansen, 2006/06/20
- Re: string-strip, Richard Stallman, 2006/06/20
- Re: string-strip, Andreas Roehler, 2006/06/20