Esempio n. 1
0
TStr TEnv::GetArgPostfix(const TStr& PrefixStr) const {
    int ArgN = GetPrefixArgN(PrefixStr);
    IAssert(ArgN != -1);
    TStr ArgStr = GetArg(ArgN);
    ArgStr.DelStr(PrefixStr);
    return ArgStr;
}
Esempio n. 2
0
TEST(TStr, Del) {
	TStr Str = "aabbaabb";
	TStr Empty = "";
	
	TStr Test = Str;
	Test.DelChAll('a');
	EXPECT_EQ(Test, "bbbb");
	Test.DelChAll('c');
	EXPECT_EQ(Test, "bbbb");
	
	Test = Str;
	Test.DelSubStr(2, 3);
	EXPECT_EQ(Test, "aaaabb");
	
	Test.DelSubStr(0, 1);
	EXPECT_EQ(Test, "aabb");
	Test.DelSubStr(2, 3);
	EXPECT_EQ(Test, "aa");
	
	EXPECT_ANY_THROW(Test.DelSubStr(-1, 5));
	
	Test.DelSubStr(0, 1);
	EXPECT_EQ(Test, "");
	Test = Str;
	Test.DelSubStr(0, 0);
	EXPECT_EQ(Test, "abbaabb");
	

	Test = Str;
	EXPECT_TRUE(Test.DelStr("ab"));
	EXPECT_EQ(Test, "abaabb");
	EXPECT_FALSE(Test.DelStr("fs"));
	EXPECT_EQ(Test, "abaabb");

	Test = Str;
	EXPECT_EQ(2, Test.DelStrAll("ab"));
	EXPECT_EQ(Test, "abab");
}