How can I define a Unicode block of a character, in particular Qt QChar?

In Java, I was able to determine if there was a particular character, such as Japanese kanji, using Unicode.blockOf (Character). I am trying to do the same for QChar, but could not find the appropriate function for this. I wonder if I just missed it, or I have to roll on my own, and if so - how?

+3
source share
2 answers

There is QChar :: Category , since it does not provide everything you need, to check if char is in a certain range, you can write a function like this:

bool inRange(QChar c, ushort b, ushort e) {
    return (c.unicode() >= b) && (c.unicode() <= e);
}

Then you can use it as follows:

inRange(c, 0x3040, 0x309F); // Hiragana?

, :

inRange(c, Range::Hiragana);

- Unicode

+3

, Qt. , ICU , .

ICU "C/++" Java. Java- ICU Java i18n/l10n, C/++, , .

0

Source: https://habr.com/ru/post/1779880/


All Articles