diff options
Diffstat (limited to 'autoload/xolox/misc/str.vim')
-rw-r--r-- | autoload/xolox/misc/str.vim | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/autoload/xolox/misc/str.vim b/autoload/xolox/misc/str.vim new file mode 100644 index 0000000..74a05aa --- /dev/null +++ b/autoload/xolox/misc/str.vim @@ -0,0 +1,12 @@ +" Vim auto-load script +" Author: Peter Odding <peter@peterodding.com> +" Last Change: June 14, 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 |