//******************************************************** // The following code example is taken from the book // C++23 - The Complete Guide // by Nicolai M. Josuttis (www.josuttis.com) // http://www.cppstd23.com // // The code is licensed under a // Creative Commons Attribution 4.0 International License // http://creativecommons.org/licenses/by/4.0/ //******************************************************** #include #include int main() { std::string s = "value: '\t'"; // some chars with single quote and tabulator std::println("default: {}", s); std::println("{{:s}} : {:s}", s); std::println("{{:?}} : {:?}", s); std::println("{{:.3}} : {:.3}", s); std::println("{{:.3?}} : {:.3?}", s); std::println("{{:*^20?}} : {:*^20?}", s); std::println("{{:*^20.3?}} : {:*^20.3?}\n", s); std::println("s[7]:"); std::println(" {{}} : {}", s[7]); std::println(" {{:?}} : {:?}", s[7]); }