C++ 23 · Language basics

Format text

Build a string with placeholders using std::format (C++20).

#include <format>

std::string s = std::format("{} scored {:.1f}%", name, percent);

Official C++ 23 documentation

More language basics commands

All language basics commands · C++ 23 cheatsheet

Was this page helpful?