Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

some new string stripping funcs

  • Loading branch information...
commit e6f5200928d6c3e8d94da0c7918397da07083255 1 parent eb7e8e4
Tavis Rudd authored
Showing with 12 additions and 0 deletions.
  1. +12 −0 dss-elisp-funcs.el
12 dss-elisp-funcs.el
View
@@ -34,6 +34,18 @@
"An asynchronous version of `dss/call-command-with-input`"
(apply 'dss/call-command-with-input (append (list command input 0) args)))
+(defun dss/chomp (str)
+ "Chomp leading and tailing whitespace from STR.
+
+ http://emaswiki.org/emas/ElispCookbook#to6"
+ (while (string-match "\\`\n+\\|^\\s-+\\|\\s-+$\\|\n+\\'"
+ str)
+ (setq str (replace-match "" t t str)))
+ str)
+
+(defun dss/strip-string (str)
+ (replace-regexp-in-string "\\`\n+\\|^\\s-+\\|\\s-+$\\'" ""
+ str))
;;; http://lists.gnu.org/archive/html/help-gnu-emacs/2009-06/msg00764.html
(defun partition-list (list length)
Please sign in to comment.
Something went wrong with that request. Please try again.