add util::crop_utf8 (stringutil)

This commit is contained in:
MihailRis
2024-08-29 15:39:14 +03:00
parent f2b9d0620a
commit f8d0a4f4c7
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, "при");
}