C++对于文本操作是非常痛苦,但有下面几个字符串的比较函数,会给你带来一点轻松。
11.icompare,不区别大小写比较,全都转化成小写,从str的第pos开始与另一个字符串从迭代器it2开始最多比较n个字符。
template <class S, class It>
int icompare(
const S& str,
typename S::size_type pos,
typename S::size_type n,
It it2,
It end2)
/// Case-insensitive string comparison
{
typename S::size_type sz = str.size();
if (pos > sz) pos = sz;
if (pos + n > sz) n = sz - pos;
It it1 = str.b......
阅读全文