mirror of
https://github.com/pocoproject/poco.git
synced 2025-11-24 06:04:15 +01:00
std::string double percent Format bug fix
This commit is contained in:
@@ -356,8 +356,8 @@ void format(std::string& result, const std::string& fmt, const std::vector<Any>&
|
|||||||
++itFmt;
|
++itFmt;
|
||||||
if (itFmt != endFmt && itVal != endVal)
|
if (itFmt != endFmt && itVal != endVal)
|
||||||
formatOne(result, itFmt, endFmt, itVal);
|
formatOne(result, itFmt, endFmt, itVal);
|
||||||
else
|
else if (itFmt != endFmt)
|
||||||
result += *itFmt;
|
result += *itFmt++;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
result += *itFmt;
|
result += *itFmt;
|
||||||
|
|||||||
@@ -318,6 +318,12 @@ void FormatTest::testString()
|
|||||||
|
|
||||||
s = format("%-5s", foo);
|
s = format("%-5s", foo);
|
||||||
assert (s == "foo ");
|
assert (s == "foo ");
|
||||||
|
|
||||||
|
s = format("%s%%a", foo);
|
||||||
|
assert (s == "foo%a");
|
||||||
|
|
||||||
|
s = format("'%s%%''%s%%'", foo, foo);
|
||||||
|
assert (s == "'foo%''foo%'");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user