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: Oliver Scholz
Subject: Re: left-trim and right-trim for strings
Date: Mon, 23 Sep 2002 13:28:07 +0200
User-agent: Gnus/5.090008 (Oort Gnus v0.08) Emacs/21.3.50 (i686-pc-linux-gnu)

Klaus Berndl <address@hidden> 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 ]*$"))

    -- Oliver

-- 
2 Vendémiaire an 211 de la Révolution
Liberté, Egalité, Fraternité!


reply via email to

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