Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 14 additions & 5 deletions include/EASTL/string_view.h
Original file line number Diff line number Diff line change
Expand Up @@ -214,12 +214,21 @@ namespace eastl
auto* pEnd = mpBegin + mnCount;
if (EASTL_LIKELY(((npos - sw.size()) >= pos) && (pos + sw.size()) <= mnCount))
{
const value_type* const pTemp = eastl::search(mpBegin + pos, pEnd, sw.data(), sw.data() + sw.size());

if ((pTemp != pEnd) || (sw.size() == 0))
return (size_type)(pTemp - mpBegin);
for (size_type i =pos;i<=mnCount-sw.size();i++){
if(mpBegin[i]==sw[0]){
//if first char matches
size_type j=1;
while(j<sw.size() && mpBegin[i+j]==sw[j]){
++j;
}
if(j==sw.size()){
//if the full str matches
return i;
}
}
}
}
return npos;
return npos;//return val if no match is found
}

EA_CONSTEXPR size_type find(T c, size_type pos = 0) const EA_NOEXCEPT
Expand Down