These are chat archives for fmtlib/fmt

10th
Nov 2015
Nicola Gigante
@nicola-gigante
Nov 10 2015 13:50
hi all
is there a way to specify a width at runtime for format specifiers? so instead of "{:<30}", specify the value as an additional argument? Of course without manually create the string beforehand
Victor Zverovich
@vitaut
Nov 10 2015 15:20
@nicola-gigante Yes:
fmt::print("{:<{}}", "foo", 30);
Nicola Gigante
@nicola-gigante
Nov 10 2015 16:26
Thanks :)
Ii didn't realize that format specifiers could be nested
so the {} inside is just a normal format specifier which is substituted with 30, and then {:<30} gets interpreted?
or is it an ad-hoc syntax for this use-case?
Rob Patro
@rob-p
Nov 10 2015 16:48
Is there an easy way to use cppformat to format large numbers with comma separators in the appropriate place?
e.g.
15000 -> 15,000
Victor Zverovich
@vitaut
Nov 10 2015 17:36
@nicola-gigante In Python it is substituted and interpreted, but in C++ Format it is handled as a special case of width specifier for efficiency.
Victor Zverovich
@vitaut
Nov 10 2015 18:49
@rob-p Unfortunately not at the moment, but it should be pretty easy to add support for a thousand separator. Feel free to submit an issue.