A string formatting library in 65 lines of C++

14 points by riki


mrexodia

Very nice, this is pretty much exactly what I planned to build for an embedded project, so thar saved me a bunch of time!

The only “issue” is that for localization you actually need to index the placeholders, since different languages have different word order. I ran into this with printf, which is decidedly not localization-friendly. The solution I came up with was to check if the format specifies appear in the exact same order, but it’s not ideal. I think Qt’s solution with QString("point: %1, %2") is actually pretty good!