From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: "Eli Zaretskii" Newsgroups: gmane.emacs.help Subject: Re: string func to use in .emacs Date: Sun, 25 Jan 2004 19:59:42 +0200 Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Message-ID: <6480-Sun25Jan2004195942+0200-eliz@elta.co.il> References: <87llnwlij0.fsf@tulip.whu.ca> <87ptd8gld8.fsf@tulip.whu.ca> Reply-To: Eli Zaretskii NNTP-Posting-Host: deer.gmane.org X-Trace: sea.gmane.org 1075053908 28815 80.91.224.253 (25 Jan 2004 18:05:08 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Sun, 25 Jan 2004 18:05:08 +0000 (UTC) Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Sun Jan 25 19:04:53 2004 Return-path: Original-Received: from monty-python.gnu.org ([199.232.76.173]) by deer.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 1Akocv-0002CL-00 for ; Sun, 25 Jan 2004 19:04:53 +0100 Original-Received: from localhost ([127.0.0.1] helo=monty-python.gnu.org) by monty-python.gnu.org with esmtp (Exim 4.24) id 1Akoct-000568-73 for geh-help-gnu-emacs@m.gmane.org; Sun, 25 Jan 2004 13:04:51 -0500 Original-Received: from list by monty-python.gnu.org with tmda-scanned (Exim 4.24) id 1AkocV-000559-6D for help-gnu-emacs@gnu.org; Sun, 25 Jan 2004 13:04:27 -0500 Original-Received: from mail by monty-python.gnu.org with spam-scanned (Exim 4.24) id 1Akobu-0004qM-Ky for help-gnu-emacs@gnu.org; Sun, 25 Jan 2004 13:04:21 -0500 Original-Received: from [192.114.186.24] (helo=legolas.inter.net.il) by monty-python.gnu.org with esmtp (Exim 4.24) id 1Akobt-0004n3-U0 for help-gnu-emacs@gnu.org; Sun, 25 Jan 2004 13:03:50 -0500 Original-Received: from zaretski ([80.230.143.158]) by legolas.inter.net.il (Mirapoint Messaging Server MOS 3.3.8-GR) with ESMTP id BDX40858; Sun, 25 Jan 2004 20:03:39 +0200 (IST) Original-To: help-gnu-emacs@gnu.org X-Mailer: emacs 21.3.50 (via feedmail 8 I) and Blat ver 1.8.9 In-reply-to: <87ptd8gld8.fsf@tulip.whu.ca> (message from Peter Wu on Sun, 25 Jan 2004 09:21:07 -0500) X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.2 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: main.gmane.org gmane.emacs.help:16344 X-Report-Spam: http://spam.gmane.org/gmane.emacs.help:16344 > From: Peter Wu > Newsgroups: gnu.emacs.help > Date: Sun, 25 Jan 2004 09:21:07 -0500 > > What I am looking for is like this: > > input := "Emacs " > output := "Emacs" > > The trailing blank space is trimmed. Try this: (let ((i (string-match " +\\'" input))) (when i (setq output (substring input 0 i)))) (You may wish to replace `output' with `input', so that it is destructively trimmed.)