Skip to content

Instantly share code, notes, and snippets.

@drozdzynski
Created January 13, 2018 09:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save drozdzynski/bc6ddc39a9e7bb7ea6ff456788fad9cc to your computer and use it in GitHub Desktop.
Save drozdzynski/bc6ddc39a9e7bb7ea6ff456788fad9cc to your computer and use it in GitHub Desktop.
Elixir CodePoint
defmodule CodePoint do
def encode(character) when is_binary(character) do
[code_point] = String.to_charlist(character)
Integer.to_string(code_point, 16)
end
def decode(code_point) when is_binary(code_point) do
[String.to_integer(code_point, 16)] |> to_string
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment