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

harness.core.CharOps.scala Maven / Gradle / Ivy

The newest version!
package harness.core

implicit class HarnessCharOps(self: Char) {

  def unesc: String = self.unesc("'")
  def unesc(leftAndRight: String): String = self.unesc(leftAndRight, leftAndRight)
  def unesc(left: String, right: String): String = {
    val charText =
      self match {
        case '\n' => "\\n"
        case '\\' => "\\\\"
        case '\t' => "\\t"
        case '"'  => "\\\""
        case c    => c.toString
      }
    s"$left$charText$right"
  }

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy