Generating a string of a multiple copies of a substring in Vim
vim
Solution
The `repeat()` function can do that; not just for strings, also for list elements:
:let l:somestr = repeat(l:char, l:x)
Problem
I'm working on a Vimscript that does some string manipulation. I'm wondering if there's a way to generate string by multiplying another string by some multiple. For example, `'a' * 5` would produce 5 a's: `'aaaaa'`. Until now, I've been doing it with a `while` loop like this: ``` let l:char = 'a' let l:x = 5 let l:i = 0 let l:somestr = "" while l:i < l:x let l:somestr .= l:char let l:i += 1 endwhile ``` This seems awfully verbose for what I'm doing. Any way to make this more compact?