Created
November 15, 2019 13:52
-
-
Save toomasv/2711cc14ce05c53c128a21aecf0931e0 to your computer and use it in GitHub Desktop.
Dehexing to char
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Red [ | |
| Purpose: {Workaround for limitation of official `dehex` func} | |
| Date: 2019-11-15 | |
| Author: "Toomas Vooglaid" | |
| Licence: "Public domain" | |
| ] | |
| de-hex: func [hex [string!] /low][ | |
| if odd? length? hex [ | |
| hex: copy next hex | |
| ] | |
| if any [low 2 = len: length? hex] [ | |
| hex: pad/with/left hex 8 #"0" | |
| ] | |
| hex: debase/base hex 16 | |
| to-char either any [low len = 2] [to-integer hex][hex] | |
| ] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment