I too think that <<x ::utf8>> is perfectly adequate.
Obviously the proposed function also lets you do "1F916" but I can't think
of a use case I've ever seen where that's necessary.
On Monday, July 18, 2016 at 11:58:27 AM UTC-4, Nathan Long wrote:
>
> 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/a304b14f-1cbb-4325-8722-ad66f3d9fb1d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.