我就这样解决了
int64 Compare(CHAR c1, CHAR c2, bool ignoreCase = false)
{
return ignoreCase ? _strnicoll(&c1, &c2, 1) : _strncoll(&c1, &c2, 1);
}
int64 IndexOf(const CHAR* buffer, CHAR c, uint count, bool ignoreCase = false)
{
for (uint i =0; i < count; i++)
{
if (Compare(*(buffer + i), c, ignoreCase) == 0)
{
return i;
}
}
return npos;
}
int64 LastIndexOf(const CHAR* buffer, CHAR c, uint count, bool ignoreCase = false)
{
while(--count >= 0)
{
if (Compare(*(buffer + count), c, ignoreCase) == 0)
{
return count;
}
}
return npos;
}
npos = -1
并指定传递给 (buffer + startIndex) 的起始索引作为第二个或第三个方法的缓冲区