diff options
| author | Markus Mittendrein <maxmitti@maxmitti.tk> | 2022-01-11 03:20:17 +0100 |
|---|---|---|
| committer | Markus Mittendrein <maxmitti@maxmitti.tk> | 2022-01-11 03:20:17 +0100 |
| commit | efc7278fb065d873eca54563c5b89f2768237564 (patch) | |
| tree | d7ce92c949b77531304c04fb36d9b8882ffafbbc /main.cpp | |
| parent | 21ef5d530404aff3c87d6bbc0cfc2890cb1045d8 (diff) | |
| download | cxxformat-efc7278fb065d873eca54563c5b89f2768237564.tar.gz cxxformat-efc7278fb065d873eca54563c5b89f2768237564.zip | |
Add ' flag for strings to quote and escape them
Diffstat (limited to 'main.cpp')
| -rw-r--r-- | main.cpp | 3 |
1 files changed, 3 insertions, 0 deletions
@@ -30,6 +30,9 @@ int main(int argc, char* argv[]) format_to("Hallo %%du %1$s %s%c %s %u = %4$#x = %4$#X = %4$#o %f!\n", std::cout, "Knirp", 's', argv[0], 42u, 1.337); assert(format("Hallo %%du %1$s %s%c %s %u = %4$#x = %4$#X = %4$#o %f!\n", "Knirp", 's', argv[0], 42u, 1.337) == "Hallo %%du %1$s %s%c %s %u = %4$#x = %4$#X = %4$#o %f!\n"_format("Knirp", 's', argv[0], 42u, 1.337)); + "-%20s-\n"_format_to(stdout, "Hallo"); + "-%'20s-\n"_format_to(stdout, R"(H\"all"o)"); + "-%'-20s-\n"_format_to(stdout, R"(H\"all"o)"); "-%6s--%6s--%6u--%6u-\n"_format_to(stdout, true, false, true, false); "-%'030f-\n"_format_to(stdout, 1'000'000.337); "-%'030a-\n"_format_to(stdout, 1'000'000.337); |
