[String] Allow using Java style %[arg$] prefix in sprintf.

This commit is contained in:
Pāvels Nadtočajevs committed 2026-02-20 15:07:58 +02:00
1 parent be587f3a2d
commit f69edf810e
2 files changed
+76 -30

No files matched your search

+9
View File
@@ -1296,6 +1296,15 @@ TEST_CASE("[String] sprintf") {
REQUIRE(error == false);
CHECK(output == String("fish 99.990 frog"));
///// Argument indices.
format = "fish %2$d frog %1$s xx";
args.clear();
args.push_back("test");
args.push_back(5);
output = format.sprintf(args, &error);
REQUIRE(error == false);
CHECK(output == String("fish 5 frog test xx"));
///// Errors
// More formats than arguments.