|
From: | Andreas Röhler |
Subject: | Generic string-strip still missing |
Date: | Fri, 25 Mar 2016 19:45:01 +0100 |
User-agent: | Mozilla/5.0 (X11; Linux i686; rv:38.0) Gecko/20100101 Icedove/38.5.0 |
Hi everybody,whilst Emacs comes with a comment-string-strip --see def below-- a generic form is seems still missing.
From newcomment.el: (defun comment-string-strip (str beforep afterp)"Strip STR of any leading (if BEFOREP) and/or trailing (if AFTERP) space."
(string-match (concat "\\`" (if beforep "\\s-*") "\\(.*?\\)" (if afterp "\\s-*\n?") "\\'") str) (match-string 1 str))Making the matcher customizable resp. to hand over as arg, seems all what's needed.
Thanks, Andreas
[Prev in Thread] | Current Thread | [Next in Thread] |