Add EncodeHex() and DecodeHex() to Redbean

This commit is contained in:
Justine Tunney 2023-07-06 15:38:08 -07:00
parent 00acd81b2f
commit a186143f62
No known key found for this signature in database
GPG key ID: BE714B4575D6E328
9 changed files with 97 additions and 13 deletions

View file

@ -47,6 +47,9 @@ assert(hex(0x1940efe9d47ae889) == "0x1940efe9d47ae889")
assert(oct(0x1940efe9d47ae889) == "0145007376472436564211")
assert(bin(0x1940efe9d47ae889) == "0b0001100101000000111011111110100111010100011110101110100010001001")
assert(EncodeHex("\1\2\3\4\255") == "01020304ff")
assert(DecodeHex("01020304ff") == "\1\2\3\4\255")
assert(EscapeHtml(nil) == nil)
assert(EscapeHtml("?hello&there<>") == "?hello&amp;there&lt;&gt;")