Victor-Savu / cpp-str-fmt

Format strings for c++14

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

cpp-str-fmt

This library aims to offer a simple C++ interface for string formatting by making use of modern (c++14) language features.

Here is a short example of what the syntax looks like:

  constexpr auto f = "Hello, %!\n"_fmt;
  std::cout << f("world");

And a somewhat longer one:

  constexpr auto bottles = R"(
      % bottles of beer on the wall, % bottles of beer.
      If one of those bottles should happen to fall,
                     % bottle% of beer on the wall....
  )"_fmt;

  for (int i = 99; i > 1; --i)
    std::cout << bottles(i, i, i - 1, (i - 1 > 1) ? "s" : "");

  std::cout << R"(
      If that one bottle should happen to fall,
                     what a waste of alcohol!)" << std::endl;

About

Format strings for c++14

License:Apache License 2.0


Languages

Language:C++ 100.0%