feat: add code point splittor for utf8 string.

- this feature is added for strip function in string op.
This commit is contained in:
yyc12345 committed 2025-09-26 21:43:12 +08:00
1 parent 99146ddd55
commit 190beeed58
3 files changed
+231 -2

No files matched your search

+22
View File
@@ -71,6 +71,28 @@ namespace yycctest::string::op {
EXPECT_EQ(rv, u8", 1, 2, ");
}
TEST(StringOp, Strip) {
// Normal strip
{
auto rv = OP::to_strip(u8" \taaa\n", u8" \t\r\n");
EXPECT_EQ(rv, u8"aaa");
}
// Special strip
{
auto rv = OP::to_strip(u8"亜亜亜aaaあああ", u8"亜あ");
EXPECT_EQ(rv, u8"aaa");
}
{
auto rv = OP::to_strip(u8"亜亜亜aaaあああ", u8"亜");
EXPECT_EQ(rv, u8"aaaあああ");
}
{
auto rv = OP::to_strip(u8"亜亜亜aaaあああ", u8"あ");
EXPECT_EQ(rv, u8"亜亜亜aaa");
}
}
TEST(StringOp, Split) {
// Normal
{