runeToLowerCase function Null safety
- int rune
Convert a UTF32 rune to its lower case.
Implementation
int runeToLowerCase(int rune) {
// Assume only Basic Multilingual Plane runes have lower and upper cases.
// For other characters, return them as is.
const int utf16BmpUpperBound = 0xD7FF;
if (rune > utf16BmpUpperBound) {
return rune;
}
return String.fromCharCode(rune).toLowerCase().codeUnitAt(0);
}