moo::format
moo::format is a light "std::format / fmt" substitute.
Description:
moo::format is a light substitute to "std::format/fmt". It inserts arguments into a string model, example code can be found below.
Side Quest: If you are looking to make a little bit of coin the moo::formatParse function could use an upgrade.
Parameters:
moo::format(const char* formatString, Args... args);
Name |
Type |
Description |
formatString |
const char* |
The string "model/template" that the additional arguments are inserted into. |
args |
std::string
const char*
char
int
long
long long
unsigned
unsigned long
unsigned long long
float
double
long double
|
The values inserted into the the string "model/template". |
Example:
#include <iostream>
#include "format.h"
int main()
{
std::cout << moo::format("{} are ${}", "chocolate bars", 1.25);
return 0;
}
// Output: chocolate bars are $1.25
Setup Guide:
- Download or copy the format.h file.
- Add the header file to your project.
- Add your include directive... #include "{filepath}/format.h".
- (Optional) Run the unit tests, found at the bottom of the format.h file.
- Profit?