From a205f918f5797d9183f7f479360ed91bbce2b388 Mon Sep 17 00:00:00 2001 From: Peter Odding Date: Tue, 15 Mar 2011 23:00:55 +0100 Subject: Initial commit --- str.vim | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 str.vim (limited to 'str.vim') diff --git a/str.vim b/str.vim new file mode 100644 index 0000000..19bfe09 --- /dev/null +++ b/str.vim @@ -0,0 +1,12 @@ +" Vim auto-load script +" Author: Peter Odding +" Last Change: March 15, 2011 +" URL: http://peterodding.com/code/vim/misc/ + +" Trim whitespace from start and end of string. + +function! xolox#misc#str#trim(s) + return substitute(a:s, '^\s*\(.\{-}\)\s*$', '\1', '') +endfunction + +" vim: ts=2 sw=2 et -- cgit v1.2.3