mirror of
https://github.com/pocoproject/poco.git
synced 2024-12-13 18:45:10 +01:00
Can't cash str.begin when "insert" is involved.
This commit is contained in:
parent
279370c5cb
commit
bc87b2841b
@ -93,12 +93,11 @@ void insertThousandSep(std::string& str, char thSep, char decSep = '.')
|
||||
std::string::size_type decPos = str.find(decSep);
|
||||
// there's no rinsert, using forward iterator to go backwards
|
||||
std::string::iterator it = str.end();
|
||||
std::string::iterator begin = str.begin();
|
||||
if (exPos != std::string::npos) it -= str.size() - exPos;
|
||||
|
||||
if (decPos != std::string::npos)
|
||||
{
|
||||
while (it != begin)
|
||||
while (it != str.begin())
|
||||
{
|
||||
--it;
|
||||
if (*it == decSep) break;
|
||||
@ -106,7 +105,7 @@ void insertThousandSep(std::string& str, char thSep, char decSep = '.')
|
||||
}
|
||||
int thCount = 0;
|
||||
if (it == str.end()) --it;
|
||||
for (; it != begin;)
|
||||
for (; it != str.begin();)
|
||||
{
|
||||
std::string::iterator pos = it;
|
||||
std::string::value_type chr = *it;
|
||||
|
Loading…
Reference in New Issue
Block a user