1 The `hexdec()` function decodes the given hexadecimal digit string into 2 a byte string, optionally skipping specified characters. 3 4 Returns null if the input string contains invalid characters or an uneven 5 amount of hex digits. 6 7 Returns the decoded byte string on success. 8 9 -- Testcase -- 10 {% 11 printf("%.J\n", [ 12 hexdec("44 55 66 77 33 44\n"), // whitespace is skipped by default 13 hexdec("44-55-66:77-33-44", ":-"), // skip specified characters 14 hexdec("abc"), // error; uneven amount of digits 15 hexdec("ab cd !"), // error; non-whitespace, non-hex, non-skipped char 16 hexdec(1234), // error; non-string input 17 ]); 18 %} 19 -- End -- 20 21 -- Expect stdout -- 22 [ 23 "DUfw3D", 24 "DUfw3D", 25 null, 26 null, 27 null 28 ] 29 -- End --
This page was automatically generated by LXR 0.3.1. • OpenWrt