-
-
Save kmizu/2382750 to your computer and use it in GitHub Desktop.
16進文字列をAscii文字列に変換 (再帰を使わないバージョン)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def hexToStr(s:String):String = { | |
s.grouped(2).map{xx => Integer.parseInt(xx, 16).toChar}.mkString("") | |
} | |
val target = 'a' to 'z' mkString | |
val hexTarget = target map {"%02x" format _.toInt} mkString | |
assert(target == hexToStr(hexTarget)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment