help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: string func to use in .emacs


From: Eli Zaretskii
Subject: Re: string func to use in .emacs
Date: Sun, 25 Jan 2004 19:59:42 +0200

> From: Peter Wu <peterwu@hotmail.com>
> 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.)




reply via email to

[Prev in Thread] Current Thread [Next in Thread]