Hi! Since docs mention that transforming a string to lower or upper case is not implemented in Roc yes, and I didn't manage to find any solutions by Googling, can anyone suggest a solution for this?
I bet there should be some package somewhere that already implemented it
It's a unicode thing I think. It's not implemented in roc-lang/unicode yet.
Correction... if you know you're only dealing with Ascii checkout Hannes https://github.com/Hasnep/roc-ascii
It also tripped me up when I worked on some exercism tasks. Usually you would find such functions in any language.
Having said that, it was a nice exercise to think about ASCII vs Unicode again and what it actually means to e.g. downcase characters in a string.
I think uppercasing a Unicode string is technically locale dependent
But if you just have ascii, it is as easy as changing a single bit.
yep, uppercasing "i" gives a different answers depending on whether you're talking about English or Turkish
most languages either incorrectly handle that case or silently do something different depending on the system locale, but I don't think we should do either; I think we should correctly and explicitly handle that, so that a Roc pure function always gives the same answer no matter what system you run it on
which is why it's not in the standard library; locales change over time, so the idea is to have a separate package for that.
Last updated: Jul 06 2025 at 12:14 UTC