Created
July 18, 2015 14:09
-
-
Save yhsgw/4c2a3b4c3bc1027e1933 to your computer and use it in GitHub Desktop.
16進ダンプした文字列を1byte毎の配列に変換する例
This file contains hidden or 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
// "010aff"のような16進ダンプを、[1, 10, 255]のバイト配列に変換する/ | |
var dumpToByteArray = function(str){ | |
var byte_str = str.match(new RegExp(".{1,2}", "g")); | |
return byte_str.map(function(x){return "0x" + x; }).map(function(y){return parseInt(y)}); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment