Code Golf Measurer © 2019
Hexdumps used with xxd
look something like this:
00000000: 666f 6f20 6261 7220 7370 616d 2065 6767 foo bar spam egg
00000010: 730a s.
Your task is to convert a hexdump in this form in to the number of bytes used.
Rules:
- Usual loopholes forbidden.
- This is code-golf, so shortest valid answer in bytes wins.
- You may or may not include the newline at the end of text (
0a
). This means that if the hexdump ends in a newline (0a
), that input may have it's output reduced by one. - An empty input (literally nothing: empty list/string/etc.) must output 0.
- Input can be taken in any form
- Input will be valid ASCII with no control characters
- The input must contain the whole hexdump
Test cases:
00000000: 4865 6c6c 6f2c 2077 6f72 6c64 2120 4865 Hello, world! He
00000010: 6c6c 6f2c 2077 6f72 6c64 210a llo, world!.
returns 28 or 27
00000000: 0a .
returns 1 or 0
00000000: 6368 616c 6c65 6e67 650a challenge.
returns 10 or 9
00000000: 4865 6c6c 6f2c 2077 6f72 6c64 21 Hello, world!
returns 13
returns 0 (This is literally nothing: empty list/string/etc.)
Explanations would be nice for non-standard languages.
xxd
is fed an empty string, it outputs nothing. \$\endgroup\$objdump
disassembly ornasm
listings for machine-code answers.) I guess I should post that in the sandbox... \$\endgroup\$