diff options
author | Roland Reichwein <mail@reichwein.it> | 2021-01-30 19:20:15 +0100 |
---|---|---|
committer | Roland Reichwein <mail@reichwein.it> | 2021-01-30 19:20:15 +0100 |
commit | 2ef9f51df48b14556e236d14213233e1bd7f829a (patch) | |
tree | f5230e326501ebaec1baca9615dc69b7538f1911 /include | |
parent | ee9dfd30e8c02e9a7457385786218d2b4b935720 (diff) |
Added Support for Debian and Ubuntu, add is_valid_utf()
Diffstat (limited to 'include')
-rw-r--r-- | include/unicode.h | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/include/unicode.h b/include/unicode.h index 9e0132b..f31cbac 100644 --- a/include/unicode.h +++ b/include/unicode.h @@ -339,5 +339,16 @@ namespace unicode { return result; } + template<typename T> + bool is_valid_utf(const std::basic_string<T>& s) + { + try { + std::for_each(utf_begin<T>(s), utf_end<T>(s), [](const T& c){}); + } catch(...) { + return false; + } + return true; + } + } // namespace unicode |