aboutsummaryrefslogtreecommitdiffstats
path: root/autoload/xolox/misc/str.vim
diff options
context:
space:
mode:
Diffstat (limited to 'autoload/xolox/misc/str.vim')
-rw-r--r--autoload/xolox/misc/str.vim12
1 files changed, 9 insertions, 3 deletions
diff --git a/autoload/xolox/misc/str.vim b/autoload/xolox/misc/str.vim
index 74a05aa..901696c 100644
--- a/autoload/xolox/misc/str.vim
+++ b/autoload/xolox/misc/str.vim
@@ -1,11 +1,17 @@
-" Vim auto-load script
+" String handling.
+"
" Author: Peter Odding <peter@peterodding.com>
-" Last Change: June 14, 2011
+" Last Change: May 19, 2013
" URL: http://peterodding.com/code/vim/misc/
-" Trim whitespace from start and end of string.
+function! xolox#misc#str#compact(s)
+ " Compact whitespace in the string given as the first argument.
+ return join(split(a:s), " ")
+endfunction
function! xolox#misc#str#trim(s)
+ " Trim all whitespace from the start and end of the string given as the
+ " first argument.
return substitute(a:s, '^\_s*\(.\{-}\)\_s*$', '\1', '')
endfunction