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

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

Re: left-trim and right-trim for strings


From: Klaus Berndl
Subject: Re: left-trim and right-trim for strings
Date: 23 Sep 2002 12:02:53 +0200
User-agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.1

On Mon, 23 Sep 2002, Oliver Scholz wrote:



>  Klaus Berndl <Klaus.Berndl@sdm.de> writes:
>  
> > left-trim: Removing any leading whitespace from a string.
> > right-trim: Removing any trailing whitespace from a string.
> >
> > Are there such functions available in elisp or have i to write them
> > for myself?
>  
>  Probably rather a dirty trick, but you could abuse `split-string':
>  
>  (car (split-string "    Dies ist ein Test." "^[\n\t ]*"))
>  (car (split-string "Dies ist ein Test.    " "[\n\t ]*$"))

Dirty but also charming :-)

I think i will use it.

Thanks,
Klaus


-- 
Klaus Berndl                    mailto: klaus.berndl@sdm.de
sd&m AG                         http://www.sdm.de
software design & management    
Thomas-Dehler-Str. 27, 81737 München, Germany
Tel +49 89 63812-392, Fax -220


reply via email to

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