toBlackboardBold static method
Converts to Blackboard Bold - \mathbb Mapping range: A-Z (U+1D538), a-z (U+1D552), 0-9 (U+1D7D8)
Implementation
static String toBlackboardBold(String text) {
return text.runes
.map((runes) {
if (runes >= 65 && runes <= 90) {
// 'A' to 'Z'
switch (runes) {
case 67:
return "ℂ"; // 'C'
case 72:
return "ℍ"; // 'H'
case 78:
return "ℕ"; // 'N'
case 80:
return "ℙ"; // 'P'
case 81:
return "ℚ"; // 'Q'
case 82:
return "ℝ"; // 'R'
case 90:
return "ℤ"; // 'Z'
default:
return _codePointToString(0x1D538 + (runes - 65));
}
} else if (runes >= 97 && runes <= 122) {
// 'a' to 'z'
return _codePointToString(0x1D552 + (runes - 97));
} else if (runes >= 48 && runes <= 57) {
// '0' to '9'
return _codePointToString(0x1D7D8 + (runes - 48));
}
return String.fromCharCode(runes);
})
.join("");
}