Obtain codepoint for character #1877
Unanswered
wezm
asked this question in
Questions & support
Replies: 3 comments 6 replies
-
This should help you, gleam-lang/stdlib#37 right, if it does you could thumb it :D |
Beta Was this translation helpful? Give feedback.
5 replies
-
Related to this query, is there a way to match on numeric ranges at the moment? My searching suggests that there isn't a pattern syntax for this but I thought I'd double check. |
Beta Was this translation helpful? Give feedback.
0 replies
-
If you want to treat the string/grapheme as an int, that's all you need to do:
|
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
For Advent of Code day 3 there was this detail:
Given a string containing only a-z, A-Z the idea was to calculate the "priority" of each character.
string.to_graphemes
appears to be the way to get the "characters" of a string. So I then hadList(String)
and wanted to get the code point of the character/grapheme that the String was holding. I couldn't work out how to do this. It seems like bit strings might be able to do it, this is what I tried:but I couldn't work out how to convert
UtfCodepoint
into anInt
. I note that the string module has a function to go the other way though.Is this possible? In the end I just wrote out a big case expression:
Beta Was this translation helpful? Give feedback.
All reactions