Enhancement - caseless find

- Fixed bug that didn't properly consider the starting offset in find.
This commit is contained in:
Paul Beckingham 2010-01-27 10:38:38 -05:00
parent 06ecef76d3
commit 9cab749016

View file

@ -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)