Esempio n. 1
0
bool EndsWithT(const STR& str, const STR& search, bool case_sensitive) {
	size_t str_length = str.length();
	size_t search_length = search.length();
	if (search_length > str_length)
		return false;
	if (case_sensitive)
		return str.compare(str_length - search_length, search_length, search) == 0;
	return std::equal(search.begin(), search.end(),
		str.begin() + (str_length - search_length),
		base::CaseInsensitiveCompare<typename STR::value_type>());
}
Esempio n. 2
0
bool StartsWithT(const STR& str, const STR& search, bool case_sensitive) {
	if (case_sensitive) {
		return str.compare(0, search.length(), search) == 0;
	}
	else {
		if (search.size() > str.size())
			return false;
		return std::equal(search.begin(), search.end(), str.begin(),
			base::CaseInsensitiveCompare<typename STR::value_type>());
	}
}