Sha256: 6682b95141d3f35f7d6e2b90264a0785bb04a4eb6511edf96cdea13e0b7a09fc

Contents?: true

Size: 281 Bytes

Versions: 37

Compression:

Stored size: 281 Bytes

Contents

case class Atbash() {
  def encode(s: String): String =
    s.foldLeft("")((acc, c) => acc + substitute(c)).grouped(5).mkString(" ")

  private def substitute(c: Char) =
    if (c.isDigit) c.toString
    else if (c.isLetter) ('a' + ('z' - c.toLower)).toChar.toString
    else ""
}

Version data entries

37 entries across 37 versions & 1 rubygems

Version Path
trackler-2.0.5.0 tracks/scala/exercises/atbash-cipher/example.scala
trackler-2.0.4.0 tracks/scala/exercises/atbash-cipher/example.scala
trackler-2.0.3.9 tracks/scala/exercises/atbash-cipher/example.scala
trackler-2.0.3.8 tracks/scala/exercises/atbash-cipher/example.scala
trackler-2.0.3.7 tracks/scala/exercises/atbash-cipher/example.scala
trackler-2.0.3.6 tracks/scala/exercises/atbash-cipher/example.scala
trackler-2.0.3.5 tracks/scala/exercises/atbash-cipher/example.scala
trackler-2.0.3.4 tracks/scala/exercises/atbash-cipher/example.scala
trackler-2.0.3.3 tracks/scala/exercises/atbash-cipher/example.scala
trackler-2.0.3.2 tracks/scala/exercises/atbash-cipher/example.scala
trackler-2.0.3.1 tracks/scala/exercises/atbash-cipher/example.scala
trackler-2.0.3.0 tracks/scala/exercises/atbash-cipher/example.scala
trackler-2.0.2.0 tracks/scala/exercises/atbash-cipher/example.scala
trackler-2.0.1.2 tracks/scala/exercises/atbash-cipher/example.scala
trackler-2.0.1.1 tracks/scala/exercises/atbash-cipher/example.scala
trackler-2.0.1.0 tracks/scala/exercises/atbash-cipher/example.scala
trackler-2.0.0.10 tracks/scala/exercises/atbash-cipher/example.scala
trackler-2.0.0.9 tracks/scala/exercises/atbash-cipher/example.scala
trackler-2.0.0.8 tracks/scala/exercises/atbash-cipher/example.scala
trackler-2.0.0.7 tracks/scala/exercises/atbash-cipher/example.scala