mirror of
https://github.com/pocoproject/poco.git
synced 2025-04-27 02:16:16 +02:00
fix typo
This commit is contained in:
parent
0ad8b3c924
commit
c33bf13bdc
@ -78,6 +78,12 @@ StringTokenizer::StringTokenizer(const std::string& str, const std::string& sepa
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
StringTokenizer::~StringTokenizer()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
std::size_t StringTokenizer::count(const std::string& token) const
|
||||
{
|
||||
std::size_t result = 0;
|
||||
@ -120,65 +126,6 @@ std::size_t StringTokenizer::replace(const std::string& oldToken, const std::str
|
||||
return result;
|
||||
}
|
||||
|
||||
StringTokenizer::~StringTokenizer()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
bool StringTokenizer::has(const std::string& token) const
|
||||
{
|
||||
Iterator it = begin();
|
||||
Iterator stop = end();
|
||||
for (; it != stop; ++it)
|
||||
if (*it == token)
|
||||
return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
std::size_t StringTokenizer::find(const std::string& token, std::size_t pos) const
|
||||
{
|
||||
Iterator it = begin();
|
||||
Iterator stop = end();
|
||||
for (it += pos; it != stop; ++it)
|
||||
if (*it == token)
|
||||
return it - begin();
|
||||
|
||||
throw NotFoundException(token);
|
||||
}
|
||||
|
||||
|
||||
std::size_t StringTokenizer::replace(const std::string& oldToken, const std::string& newToken, std::size_t pos)
|
||||
{
|
||||
std::size_t count = 0;
|
||||
TokenVec::iterator it = _tokens.begin();
|
||||
TokenVec::iterator stop = _tokens.end();
|
||||
for (it += pos; it != stop; ++it)
|
||||
{
|
||||
if (*it == oldToken)
|
||||
{
|
||||
*it = newToken;
|
||||
++count;
|
||||
}
|
||||
}
|
||||
|
||||
return count;
|
||||
}
|
||||
|
||||
|
||||
std::size_t StringTokenizer::count(const std::string& token) const
|
||||
{
|
||||
std::size_t cnt = 0;
|
||||
Iterator it = begin();
|
||||
Iterator stop = end();
|
||||
for (; it != stop; ++it)
|
||||
if (*it == token)
|
||||
++cnt;
|
||||
|
||||
return cnt;
|
||||
}
|
||||
|
||||
|
||||
} // namespace Poco
|
||||
|
||||
|
@ -31,15 +31,12 @@
|
||||
// DEALINGS IN THE SOFTWARE.
|
||||
//
|
||||
|
||||
|
||||
#ifndef StringTokenizerTest_INCLUDED
|
||||
#define StringTokenizerTest_INCLUDED
|
||||
|
||||
|
||||
#include "Poco/Foundation.h"
|
||||
#include "CppUnit/TestCase.h"
|
||||
|
||||
|
||||
class StringTokenizerTest: public CppUnit::TestCase
|
||||
{
|
||||
public:
|
||||
@ -48,7 +45,6 @@ public:
|
||||
|
||||
void testStringTokenizer();
|
||||
void testFind();
|
||||
void testFind();
|
||||
|
||||
void setUp();
|
||||
void tearDown();
|
||||
@ -58,5 +54,4 @@ public:
|
||||
private:
|
||||
};
|
||||
|
||||
|
||||
#endif // StringTokenizerTest_INCLUDED
|
||||
|
Loading…
x
Reference in New Issue
Block a user