Skip to content

Instantly share code, notes, and snippets.

@jbranchaud
Created September 14, 2016 19:02
Show Gist options
  • Save jbranchaud/5a7786bac1ed5ade103bdd740ea52857 to your computer and use it in GitHub Desktop.
Save jbranchaud/5a7786bac1ed5ade103bdd740ea52857 to your computer and use it in GitHub Desktop.
Elixir String Graphemes, Codepoints, Bytes
> string1 = "\u0065\u0301"
"é"
> string2 = "é"
"é"
> string1 == string2
false
> String.codepoints(string1)
["e", "́"]
> String.codepoints(string2)
["é"]
> byte_size(string1)
3
> byte_size(string2)
2
> String.graphemes(string1)
["é"]
> String.graphemes(string2)
["é"]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment