问题
I need to clear console screen in Scala
I've tried standard ANSI Clear screen which was suggested as "Terminal control/Clear the screen" by rosettacode.org here
object Cls extends App {print("\033[2J")}
I got following error:
Error:(8, 14) octal escape literals are unsupported: use \u001b instead
println("\033[2J")
回答1:
I found solution for my question and I'll share it here for others, apparently from Scala 2.10 Octal litherals are deprecated see here. In question above "\033[2J" didn't work since Octal litherals were deprecated, so just listen to compiler and replace it with "\u001b[2J" as shown below:
object Cls extends App {print("\u001b[2J")}
来源:https://stackoverflow.com/questions/56608263/how-to-clear-terminal-screen-in-scala