Skip to content

Instantly share code, notes, and snippets.

@ckhrysze
Last active March 28, 2016 16:34
Show Gist options
  • Select an option

  • Save ckhrysze/76ece39ad6a0c4c2c55e to your computer and use it in GitHub Desktop.

Select an option

Save ckhrysze/76ece39ad6a0c4c2c55e to your computer and use it in GitHub Desktop.
Demonstrate output of elixir code showing grapheme vs codepoints
a = "noël"
IO.puts a
IO.puts String.reverse(a)
IO.puts String.slice(a, 0..2)
IO.puts String.length(a)
b = "😸😾"
IO.puts b
IO.puts String.length(b)
IO.puts String.slice(b, 1..-1)
IO.puts String.reverse(b)
c = "baffle"
IO.puts c
IO.puts String.upcase(c)
d = "noël"
IO.puts d
IO.puts a == d
IO.puts String.equivalent?(a, d)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment