harness.core.CharOps.scala Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of harness-core_sjs1_3 Show documentation
Show all versions of harness-core_sjs1_3 Show documentation
Miscellaneous libraries/utilities for Scala.
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