How to print the same char n times in Haskell

后端 未结 3 412
无人共我
无人共我 2021-01-21 00:01

I would like to print a char underlining a String n times, with n the length of the String in Haskell.

How should I do this?

My String is: \"Available Chars (x)\

3条回答
  •  庸人自扰
    2021-01-21 01:00

    got it!

    replicate n 'charHere'
    

    for example, if you want to repeat the char '-' 12 times:

    replicate 12 '-'
    

提交回复
热议问题