예제 #1
0
// Split the target string into its pointer and its qualifier(s)
void FUStringConversion::SplitTarget(const fm::string& target, fm::string& pointer, fm::string& qualifier)
{
	size_t splitIndex = target.find_first_of("([.");
	if (splitIndex != fm::string::npos)
	{
		pointer = target.substr(0, splitIndex);
		qualifier = target.substr(splitIndex);
	}
	else
	{
		pointer = target;
		qualifier.clear();
	}
}
예제 #2
0
	PassIf(a.length() == 5);
	PassIf(a.substr(0, 4) == c.substr(0, 4));
	FailIf(a == c);
	PassIf(a < c);

	e.append("4");
	b.append(a);
	PassIf(IsEquivalent(e, "CCC4"));
	PassIf(IsEquivalent(b, "TEST1TEST1"));
	PassIf(b.find("TEST1", 0) == 0);
	PassIf(b.find("TEST1", 2) == 5);
	PassIf(b.find("TEST1", 5) == 5);
	PassIf(b.find("TEST1", 7) == fm::string::npos);
	FailIf(c.find("TEST1") != fm::string::npos);
	PassIf(IsEquivalent(a.c_str(), "TEST1"));
	PassIf(d.find_first_of("RST") == 2);
	PassIf(c.find_last_of("T") == 3);

	e.erase(3, 4);
	a.erase(0, fm::string::npos);
	b.clear();
	PassIf(IsEquivalent(e, "CCC"));
	PassIf(e.find_first_of("TEST1ORANYTHINGELSETHATDOESNOTHAVE_?_") == fm::string::npos);
	PassIf(a.length() == 0);
	PassIf(IsEquivalent(a, ""));
	PassIf(a.empty());
	PassIf(a == b);
	PassIf(a.empty());
	PassIf(IsEquivalent(a.c_str(), b)); // c_str() will ensure that the vector<char> is NULL-terminated.
	PassIf(a.empty());
	PassIf(a == b);