add util::crop_utf8 (stringutil)

This commit is contained in:
MihailRis
2024-08-29 13:01:32 +03:00
parent b34fddbe94
commit 25bdcc8e1b
3 changed files with 38 additions and 0 deletions
+10
View File
@@ -0,0 +1,10 @@
#include "util/stringutil.hpp"
#include <gtest/gtest.h>
TEST(stringutil, crop_utf8) {
// Project source files must be UTF-8 encoded
std::string str = "пример";
str = str.substr(0, util::crop_utf8(str, 7));
EXPECT_EQ(str, "при");
}