RosettaCodeData/Task/Base64-decode-data/Scala/base64-decode-data.scala

15 lines
385 B
Scala

import java.util.Base64
object Base64Decode extends App {
def text2BinaryDecoding(encoded: String): String = {
val decoded = Base64.getDecoder.decode(encoded)
new String(decoded, "UTF-8")
}
def data =
"VG8gZXJyIGlzIGh1bWFuLCBidXQgdG8gcmVhbGx5IGZvdWwgdGhpbmdzIHVwIHlvdSBuZWVkIGEgY29tcHV0ZXIuCiAgICAtLSBQYXVsIFIuIEVocmxpY2g="
println(text2BinaryDecoding(data))
}