#if __has_include() #define JVALIDATE_HAS_ICU #include #endif namespace jvalidate::detail { inline size_t length(std::string_view arg) { #ifdef JVALIDATE_HAS_ICU icu::UnicodeString ucs = icu::UnicodeString::fromUTF8(icu::StringPiece(arg)); return ucs.countChar32(); #else return arg.size(); #endif } }