From: Lars Hansen <lists@soem.dk>
Cc: emacs-devel@gnu.org, "Kim F. Storm" <storm@cua.dk>
Subject: Re: string-strip
Date: Wed, 28 Jun 2006 13:52:30 +0200 [thread overview]
Message-ID: <44A26D7E.1030000@soem.dk> (raw)
In-Reply-To: <m3veqth7pd.fsf@kfs-l.imdomain.dk>
[-- Attachment #1: Type: text/plain, Size: 174 bytes --]
Kim F. Storm wrote:
>Looks good to me.
>
>But I think examples belong in the manual, not in the doc string.
>
>
It seems that there are no more objections. Can I install?
[-- Attachment #2: subr.diff --]
[-- Type: text/x-patch, Size: 1129 bytes --]
*** /home/lh/cvsroot/emacs/lisp/subr.el 2006-06-13 12:37:24.000000000 +0200
--- subr.el 2006-06-28 13:44:50.916887229 +0200
***************
*** 2615,2620 ****
--- 2615,2636 ----
\f
;;;; Replacement in strings.
+ (defconst string-strip-default-white-space "[ \f\t\n\r\v]*"
+ "The default value of white-space for `string-strip'.
+ A regexp matching strings of white space.")
+
+ (defun string-strip (string &optional white-space)
+ "Remove leading and trailing WHITE-SPACE from STRING.
+ If WHITE-SPACE is non-nil, it should be a regular expression matching white
+ space. If nil it defaults to `string-strip-default-white-space', normally
+ \"[ \\f\\t\\n\\r\\v]*\"."
+ (let ((ws (or white-space string-strip-default-white-space)))
+ (save-match-data
+ (string-match
+ (concat "\\`\\(?:" ws "\\)\\(\\(?:.\\|\n\\)*?\\)\\(?:" ws "\\)\\'")
+ string)
+ (match-string 1 string))))
+
(defun subst-char-in-string (fromchar tochar string &optional inplace)
"Replace FROMCHAR with TOCHAR in STRING each time it occurs.
Unless optional argument INPLACE is non-nil, return a new string."
[-- Attachment #3: Type: text/plain, Size: 142 bytes --]
_______________________________________________
Emacs-devel mailing list
Emacs-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-devel
next prev parent reply other threads:[~2006-06-28 11:52 UTC|newest]
Thread overview: 35+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-06-16 8:07 string-strip Andreas Roehler
2006-06-19 7:42 ` string-strip Richard Stallman
2006-06-19 17:59 ` string-strip Lars Hansen
2006-06-19 18:24 ` string-strip Stuart D. Herring
2006-06-19 20:20 ` string-strip Lars Hansen
2006-06-19 20:23 ` string-strip Andreas Schwab
2006-06-19 22:04 ` string-strip Kim F. Storm
2006-06-19 23:19 ` string-strip Richard Stallman
2006-06-20 6:34 ` string-strip Lars Hansen
2006-06-20 17:55 ` string-strip Richard Stallman
2006-06-20 19:28 ` string-strip Andreas Roehler
2006-06-20 19:50 ` string-strip Nick Roberts
2006-06-20 22:03 ` string-strip Kim F. Storm
2006-06-20 22:25 ` string-strip Nick Roberts
2006-06-20 22:42 ` string-strip Johan Bockgård
2006-06-21 16:47 ` string-strip Lars Hansen
2006-06-22 9:15 ` string-strip Kim F. Storm
2006-06-22 11:21 ` string-strip Andreas Roehler
2006-06-22 15:48 ` string-strip Kim F. Storm
2006-06-28 11:52 ` Lars Hansen [this message]
2006-06-28 14:47 ` string-strip Juri Linkov
2006-06-29 13:00 ` string-strip Richard Stallman
2006-07-02 16:03 ` string-strip Stefan Monnier
2006-07-03 9:58 ` string-strip Lars Hansen
2006-07-06 22:22 ` string-strip Stefan Monnier
2006-07-07 19:31 ` string-strip Richard Stallman
2006-07-08 3:59 ` string-strip Stefan Monnier
2006-07-08 20:57 ` string-strip Richard Stallman
2006-09-29 7:41 ` string-strip Andreas Roehler
2006-09-29 14:22 ` string-strip Lars Hansen
2006-09-29 18:40 ` string-strip Andreas Roehler
2006-09-29 21:45 ` string-strip Richard Stallman
2006-11-24 15:02 ` string-strip Andreas Roehler
2006-11-25 6:58 ` string-strip Richard Stallman
-- strict thread matches above, loose matches on Subject: below --
2006-06-20 10:26 string-strip Andreas Roehler
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=44A26D7E.1030000@soem.dk \
--to=lists@soem.dk \
--cc=emacs-devel@gnu.org \
--cc=storm@cua.dk \
/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.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
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).