New paste Repaste Download
auto NameUtils::isStringUnsuitableForInitials(const QString &string) -> bool
{
    if (string.isEmpty()) {
        return true;
    }
    bool isNumber;
    string.toFloat(&isNumber);
    if (isNumber) {
        return true;
    }
    static const std::array<QChar::Script, 6> scripts{
        QChar::Script_Common, QChar::Script_Inherited, QChar::Script_Latin,
        QChar::Script_Han,    QChar::Script_Hangul,    QChar::Script_Cyrillic};
    std::any_of(string.cbegin(), string.cend(), [](const QChar &character) {
        return std::find(scripts.begin(), scripts.end(), character.script()) == scripts.end();
    });
    return false;
}
Filename: None. Size: 666b. View raw, , hex, or download this file.

This paste expires on 2024-05-23 18:04:36.133703. Pasted through web.