Format a string value
| 282 | |
| 283 | // Format a string value |
| 284 | inline 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 |
| 298 | class FormatArg { |