Enhancement - caseless find
- Fixed bug that didn't properly consider the starting offset in find.
This commit is contained in:
@@ -536,12 +536,12 @@ std::string::size_type find (
|
|||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
// Handle bad begin.
|
// Handle bad begin.
|
||||||
if (begin >= len)
|
if (begin >= text.length ())
|
||||||
return std::string::npos;
|
return std::string::npos;
|
||||||
|
|
||||||
// Evaluate these once, for performance reasons.
|
// Evaluate these once, for performance reasons.
|
||||||
const char* t = text.c_str ();
|
const char* start = text.c_str ();
|
||||||
const char* start = t + begin;
|
const char* t = start + begin;
|
||||||
const char* end = start + text.size ();
|
const char* end = start + text.size ();
|
||||||
|
|
||||||
for (; t < end - len; ++t)
|
for (; t < end - len; ++t)
|
||||||
|
|||||||
Reference in New Issue
Block a user