1
0

feat: add code point splittor for utf8 string.

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

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
{