MCPcopy Create free account
hub / github.com/FastLED/FastLED / format_string

Function format_string

src/fl/stl/format.h:284–295  ·  view source on GitHub ↗

Format a string value

Source from the content-addressed store, hash-verified

282
283// Format a string value
284inline fl::string format_string(const char* value, const FormatSpec& spec) {
285 if (!value) value = "(null)";
286
287 fl::string str(value);
288
289 // Apply precision as max length for strings
290 if (spec.precision >= 0 && static_cast<fl::size>(spec.precision) < str.size()) {
291 str = fl::string(value, static_cast<fl::size>(spec.precision));
292 }
293
294 return str;
295}
296
297// Type-erased argument holder
298class FormatArg {

Callers 1

formatMethod · 0.85

Calls 2

stringClass · 0.70
sizeMethod · 0.45

Tested by

no test coverage detected