Range format specifiers in other languages?
Max Haughton
maxhaton at gmail.com
Mon Oct 12 00:44:38 UTC 2020
On Sunday, 11 October 2020 at 23:57:31 UTC, Ali Çehreli wrote:
> I find D's %( and %) range format specifiers very useful:
>
> import std.stdio;
> import std.range;
>
> void main() {
> 5.iota.writefln!"%(%s, %)"; // Prints 0, 1, 2, 3, 4
> }
>
> Are there similar features in other languages?
>
> Thank you,
> Ali
I think rust can do something similar with struct pretty
printing. The syntax has curly braces in it but I can't recall it
right now.
Possibly worth showing off (especially given that some people at
first don't even know the templated format string exists)
More information about the Digitalmars-d-learn
mailing list