Hi! I propose adding String.from_codepoint/1
Example uses:
String.from_codepoint(97) # => "a"
String.from_codepoint(128_518) # => "😆"
String.from_codepoint("1F916") # => "🤖"
I've personally wanted this while playing around with Elixir's unicode
support.
I'm not sure whether this would ever be useful in production code, but it
seems nice to me to have something symmetrical to `?a`.
The question has at least been poised before
<http://stackoverflow.com/questions/17775978/how-do-i-turn-a-unicode-code-point-into-a-unicode-string>
.
José has said "I am not a big fan of it exactly because we can write it
today as `<<cp::utf8>>`" when I made a pull request
<https://github.com/elixir-lang/elixir/pull/5030>, but he suggested I float
the idea here.
String.from_codepoint would be more discoverable and easier to use; it
would handle hexadecimal, which is how codepoints are usually referenced.
Thoughts?
--
You received this message because you are subscribed to the Google Groups
"elixir-lang-core" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/elixir-lang-core/e2ec2a8d-ee9c-4b25-9a7c-eeef72f93545%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.