Skip to content

Instantly share code, notes, and snippets.

@duncdrum
Last active November 15, 2016 12:16
Show Gist options
  • Save duncdrum/2ad0da0415c02d83eff1d128f198e640 to your computer and use it in GitHub Desktop.
Save duncdrum/2ad0da0415c02d83eff1d128f198e640 to your computer and use it in GitHub Desktop.
handy for unicode codepoint conversion
declare function local:decimal-to-hex ($x as xs:integer) {
(:convert decimal codepoints to unicode hexadecimal :)
if ($x = 0)
then ('0')
else concat(
if ($x gt 16)
then (local:decimal-to-hex($x idiv 16))
else (''),
substring('0123456789ABCDEF',
($x mod 16) + 1, 1))
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment