Add text.hexdump

This commit is contained in:
Lars Mueller 2021-03-05 11:05:47 +01:00
parent 63050f3bad
commit 2ff48fe494

@ -62,6 +62,13 @@ function inputstream(text)
return setmetatable({text = text, cursor = 0}, inputstream_metatable) return setmetatable({text = text, cursor = 0}, inputstream_metatable)
end end
function hexdump(text)
local dump = {}
for index = 1, text:len() do
dump[index] = ("%02X"):format(text:byte(index))
end
return table.concat(dump)
end
function split(text, delimiter, limit, is_regex) function split(text, delimiter, limit, is_regex)
limit = limit or math.huge limit = limit or math.huge