Created
October 10, 2010 07:40
-
-
Save kanemu/619064 to your computer and use it in GitHub Desktop.
[groovy]100本斬りお題82
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
// g100pon #82 Base64 エンコード/デコード | |
//エンコード | |
String str = '我輩は猫である。名前はまだ無い。' | |
def bs64str = str.getBytes().encodeBase64().toString() | |
assert bs64str == '5oiR6Lyp44Gv54yr44Gn44GC44KL44CC5ZCN5YmN44Gv44G+44Gg54Sh44GE44CC' | |
//デコード | |
String str2 = new String(bs64str.decodeBase64()) | |
assert str2 == str |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment