nothings / single_file_libs

List of single-file C/C++ libraries.
9.01k stars 593 forks source link

Add Unformat, which parses formatted strings (reverse of std::format) #245

Open adamyaxley opened 2 years ago

adamyaxley commented 2 years ago

Link: https://github.com/adamyaxley/Unformat

Extract from README:

Parsing and extraction of original data from brace style "{}" formatted strings. It basically unformats what you thought was formatted for good.

Unformat is simple to use and works on all basic types. See the below example for extracting a std::string and an 'int'

std::string name; int age; unformat("Harry is 18 years old.", "{} is {} years old.", name, age); // name == "Harry" and age == 18