Skip to content

Instantly share code, notes, and snippets.

@rbtnn
Created March 28, 2015 08:12
Show Gist options
  • Save rbtnn/cfb0d80c64335842a62d to your computer and use it in GitHub Desktop.
Save rbtnn/cfb0d80c64335842a62d to your computer and use it in GitHub Desktop.
function! s:hoge(str, n) abort
let begin = len(a:str) % a:n
return (begin is 0 ? [] : [a:str[:begin-1]]) + split(a:str[(begin):], repeat('.', a:n) . '\zs')
endfunction
echo s:hoge('1234', 3)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment