All Downloads are FREE. Search and download functionalities are using the official Maven repository.

scala.meta.internal.prettyprinters.Escape.scala Maven / Gradle / Ivy

The newest version!
package scala.meta
package internal
package prettyprinters

object escape {
  def apply(s: String): String = {
    // TODO: comprehensive handling
    val codepage = Map(
      "\t" -> "\\t",
      "\b" -> "\\b",
      "\n" -> "\\n",
      "\r" -> "\\r",
      "\f" -> "\\f",
      "\\" -> "\\\\"
    )
    s.flatMap(c => codepage.getOrElse(c.toString, c.toString))
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy