unicodeBlock function
Implementation
UnicodeBlock? unicodeBlock(String ch) {
int cp = ch.codeUnitAt(0);
if (cp <= 0x7F) {
return UnicodeBlock.unicodeBasicLatin;
}
int be = 0;
int en = numBlocks - 1;
while (be <= en) {
int mid = (be + en) >> 1;
Tuple3<UnicodeBlock, int, int> block = _unicodeBlocks[mid];
UnicodeBlock name = block.item1;
int start = block.item2;
int end = block.item3;
if (start <= cp && cp <= end) {
return name;
}
if (cp < start) {
en = mid - 1;
} else {
be = mid + 1;
}
}
return null;
}