How can I write a character literal for a vertical tab (‘\v’, ASCII 11) in Scala?
'\v' doesn’t work. (invalid escape character)
'\11' should be it, but…
scala> '\11'.toInt
res13: Int = 9
But 9 is the ASCII code for a normal tab(‘\t’). What is going on there?
EDIT: This works and produces the right character, but I’d still like to know the syntax for a literal.
val c:Char = 11
You need to use
'\13'. It’s in octal.For more information see Scala Language Specification.