I need to make a string of a defined length. In ruby, I would use:
str = 'a' * 5
How do I accomplish the same thing in elixir?
You can use String.duplicate/2
:
iex(1)> str = String.duplicate("a", 5)
"aaaaa"
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With