A port of the {fmt} library for Arduino.
This port is based on {fmt} 12.1.0 and is provided as a header-only wrapper to play nicely with the Arduino build system while keeping the binary size small.
Include the library:
#include "fmt.h"Format to std string:
std::string format = fmt::format("Hello {}!", "World");
Serial.println(format.c_str());Format to c buffer:
char buffer[64] = { 0 };
fmt::format_to(buffer, "mills: {}", millis());
Serial.println(buffer);For smaller binaries this port sets:
FMT_USE_LOCALEto0(locale support disabled)FMT_BUILTIN_TYPESto0(only instantiate formatting for used types)
Arduino sketches demonstrating usage are in examples/basic and examples/buffer. Tested on an ESP32S3.
To update the vendored headers, clone {fmt} and copy the folder include/fmt into this repository at src/fmt (replace the existing folder).
This is a fork of fmt-arduino that ports fmtlib to Arduino. I added Arduino String support and reduced library binary size.
FmtLib is Arduino port of {fmt} which is distributed under the MIT license.