hex-string>bytes ( hex-string -- bytes ) - Factor Documentation
Handbook
Glossary
hex-string>bytes ( hex-string -- bytes )
Hex Strings
Prev:
bytes>hex-string ( bytes -- hex-string )
Next:
md5-string? ( str -- ? )
Vocabulary
hex-strings
Inputs
hex-string
a
sequence
Outputs
bytes
a
byte-array
Word description
Converts a sequence of hex numbers in the range [00,ff] to a sequence of bytes (integers in the range [0,255]).
Examples
USING: hex-strings prettyprint ; "cafebabe" hex-string>bytes .
B{ 202 254 186 190 }
See also
bytes>hex-string
Definition
USING:
byte-arrays
kernel
math
math.parser
sequences
sequences.private
;
IN:
hex-strings
:
hex-string>bytes
( hex-string -- bytes )
dup
length
dup
even?
[
invalid-hex-string-length
]
unless
2/
<byte-array>
[
[
[
digit>
]
2dip
over
even?
[
[
16
*
]
[
2/
]
[
set-nth-unsafe
]
tri*
]
[
[
2/
]
[
[
+
]
change-nth-unsafe
]
bi*
]
if
]
curry
each-index
]
keep
;
AltStyle
によって変換されたページ
(->オリジナル)
/
アドレス:
モード:
デフォルト
音声ブラウザ
ルビ付き
配色反転
文字拡大
モバイル