Упростил функцию поиска символа

This commit is contained in:
Selim Mustafaev 2013-10-12 15:54:40 +04:00
parent 23f2e7f927
commit 829142997f

View File

@ -354,15 +354,13 @@ bool ustring::operator!=( const ustring& str ) const
std::size_t ustring::find(char32_t symbol, std::size_t pos /* = 0 */) const std::size_t ustring::find(char32_t symbol, std::size_t pos /* = 0 */) const
{ {
char32_t* pBuf = _pData + pos; char32_t* pBuf = _pData + pos;
std::size_t result = 0;
do do
{ {
if(*pBuf == symbol) if(*pBuf == symbol)
{ {
return (result + pos); return (pBuf - _pData);
} }
++result;
} }
while(*pBuf++ != 0); while(*pBuf++ != 0);