What is the easiest way to generate ind
many space? Any easier way other than using foldRight
?
(1 to ind).foldRight("") {
case (_, a) => a + " "
}
What is the easiest way to generate ind
many space? Any easier way other than using foldRight
?
(1 to ind).foldRight("") {
case (_, a) => a + " "
}
You could try this:
' '.toString * ind
Have a look at this, explaining the more generic case in detail: Efficiently repeat a character/string n times in Scala