From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: maierh@myself.com Newsgroups: gmane.emacs.help Subject: Re: left-trim and right-trim for strings Date: Tue, 24 Sep 2002 07:11:17 +0200 Organization: T-Online Sender: help-gnu-emacs-admin@gnu.org Message-ID: References: <5l3cs0o88m.fsf@rum.cs.yale.edu> Reply-To: Harald Maier NNTP-Posting-Host: localhost.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: main.gmane.org 1032845182 19720 127.0.0.1 (24 Sep 2002 05:26:22 GMT) X-Complaints-To: usenet@main.gmane.org NNTP-Posting-Date: Tue, 24 Sep 2002 05:26:22 +0000 (UTC) Return-path: Original-Received: from monty-python.gnu.org ([199.232.76.173]) by main.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 17tiDF-00057t-00 for ; Tue, 24 Sep 2002 07:26:21 +0200 Original-Received: from localhost ([127.0.0.1] helo=monty-python.gnu.org) by monty-python.gnu.org with esmtp (Exim 4.10) id 17tiDF-0000Gr-00; Tue, 24 Sep 2002 01:26:21 -0400 Original-Path: shelby.stanford.edu!nntp.stanford.edu!newsfeed.stanford.edu!news.tele.dk!small.news.tele.dk!194.25.134.62!newsfeed00.sul.t-online.de!newsmm00.sul.t-online.com!t-online.de!news.t-online.com!not-for-mail Original-Newsgroups: gnu.emacs.help Original-Lines: 23 Original-X-Trace: news.t-online.com 1032844277 06 9008 Rjqxbw6TSwAvrm 020924 05:11:17 Original-X-Complaints-To: abuse@t-online.com X-Sender: 320041125923-0001@t-dialin.net User-Agent: Gnus/5.090007 (Oort Gnus v0.07) Emacs/21.2.90 (i386-mingw-nt5.0.2195) Cancel-Lock: sha1:dJxUf/+q34D7ZsbaNozkh+9jkl8= Original-Xref: nntp.stanford.edu gnu.emacs.help:105215 Original-To: help-gnu-emacs@gnu.org Errors-To: help-gnu-emacs-admin@gnu.org X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.0.11 Precedence: bulk List-Help: List-Post: List-Subscribe: , List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: Xref: main.gmane.org gmane.emacs.help:1770 X-Report-Spam: http://spam.gmane.org/gmane.emacs.help:1770 "Stefan Monnier " writes: > How ironic. You used `split-string' just where `string-match' makes > more sense and then use `string-match' where `split-string' is just what > you need: > Why not > > (if (string-match "\\`[\n\t ]+" str) (substring str (match-end 0)) str) ? > or > (if (string-match "\\`[\n\t ]*" str) (substring str (match-end 0))) ? > Since emacs-21 we have too `replace-regexp-in-string'. Personally, I like it very much. ,---- | (replace-regexp-in-string "^ *" "" " This is a string. ") `---- Harald