I'm trying to compile simple helloworld in Scala, and get error "scala: value capitalize is not a member of Char" Why does compiler think that newW is Char?
val dict = Map(
"hello" -> "olleh",
"world" -> "dlrow"
)
def translate(input: String): String = {
input.split( """\s+""").map(w => dict.getOrElse(w.toLowerCase, w).map(newW =>
(if (w(0).isUpper) newW.capitalize else newW))
).mkString(" ")
}