From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Andreas Roehler Newsgroups: gmane.emacs.devel Subject: string-strip Date: Fri, 16 Jun 2006 10:07:14 +0200 Message-ID: <449266B2.7030500@easy-emacs.de> NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-15; format=flowed Content-Transfer-Encoding: 7bit X-Trace: sea.gmane.org 1150569163 22396 80.91.229.2 (17 Jun 2006 18:32:43 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Sat, 17 Jun 2006 18:32:43 +0000 (UTC) Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sat Jun 17 20:32:41 2006 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by ciao.gmane.org with esmtp (Exim 4.43) id 1Frfb5-0001bW-Cy for ged-emacs-devel@m.gmane.org; Sat, 17 Jun 2006 20:32:40 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Frfb4-0000L2-R9 for ged-emacs-devel@m.gmane.org; Sat, 17 Jun 2006 14:32:38 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1Fr9FL-0000gG-DQ for emacs-devel@gnu.org; Fri, 16 Jun 2006 04:00:03 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1Fr9FK-0000g4-2L for emacs-devel@gnu.org; Fri, 16 Jun 2006 04:00:02 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Fr9FJ-0000g1-UV for emacs-devel@gnu.org; Fri, 16 Jun 2006 04:00:01 -0400 Original-Received: from [212.227.126.177] (helo=moutng.kundenserver.de) by monty-python.gnu.org with esmtp (Exim 4.52) id 1Fr9Ot-0005Ts-Dy for emacs-devel@gnu.org; Fri, 16 Jun 2006 04:09:55 -0400 Original-Received: from [84.190.163.82] (helo=[192.168.178.23]) by mrelayeu.kundenserver.de (node=mrelayeu1) with ESMTP (Nemesis), id 0MKwpI-1Fr9FH2ElC-0006Vf; Fri, 16 Jun 2006 09:59:59 +0200 User-Agent: Thunderbird 1.5.0.4 (X11/20060516) Original-To: emacs-devel X-Provags-ID: kundenserver.de abuse@kundenserver.de login:62d13292e0fce6aaed56aaadcb96352d X-Mailman-Approved-At: Sat, 17 Jun 2006 14:31:27 -0400 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:55961 Archived-At: 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