Re: Formatted output ranges

2015-04-20 Thread Dennis Ritchie via Digitalmars-d-learn
On Monday, 20 April 2015 at 17:16:21 UTC, Ivan Kazmenko wrote: writeln(wrap(a, 30, ";; ", ";; ")); Works with dmd 2.066.1 and 2.067.0. Thanks.

Re: Formatted output ranges

2015-04-20 Thread Ivan Kazmenko via Digitalmars-d-learn
Yes, it's a lot better but I did not get to concatenate the string ";;" in each paragraph: - import std.conv, std.stdio, std.range, std.string; void main() { auto a = iota(10, 1101).text; a = a[1 .. $ - 1], a ~= '.'; writeln(wrap(a, 30)); } - http://ideone.com

Re: Formatted output ranges

2015-04-17 Thread Dennis Ritchie via Digitalmars-d-learn
On Friday, 17 April 2015 at 09:25:43 UTC, Ivan Kazmenko wrote: On Saturday, 11 April 2015 at 22:45:39 UTC, Dennis Ritchie wrote: I also want to know whether it is possible to D somehow set the maximum width of the print string in characters? - void main() { import std.stdio, std.ra

Re: Formatted output ranges

2015-04-17 Thread Ivan Kazmenko via Digitalmars-d-learn
On Saturday, 11 April 2015 at 22:45:39 UTC, Dennis Ritchie wrote: I also want to know whether it is possible to D somehow set the maximum width of the print string in characters? - void main() { import std.stdio, std.range; writefln(";; %(%s, %)).", iota(10, 1101)); } -

Re: Formatted output ranges

2015-04-11 Thread Dennis Ritchie via Digitalmars-d-learn
On Saturday, 11 April 2015 at 22:45:39 UTC, Dennis Ritchie wrote: I also want to know whether it is possible to D somehow set the maximum width of the print string in characters? I got to do this: - import std.stdio, std.range, std.conv, std.array; void formatWidthIotaToStr(ref string for

Re: Formatted output ranges

2015-04-11 Thread Dennis Ritchie via Digitalmars-d-learn
I also want to know whether it is possible to D somehow set the maximum width of the print string in characters? - void main() { import std.stdio, std.range; writefln(";; %(%s, %)).", iota(10, 1101)); } - For example, here's the code to Common Lisp which is given by the

Re: Formatted output ranges

2015-04-11 Thread Dennis Ritchie via Digitalmars-d-learn
On Saturday, 11 April 2015 at 20:37:17 UTC, anonymous wrote: On Saturday, 11 April 2015 at 20:10:49 UTC, Dennis Ritchie wrote: writefln("%(;; %(%s, %),\n%).", [ a[0 .. 15], a[15 .. 30], a[30 .. 45], a[45 .. 60],

Re: Formatted output ranges

2015-04-11 Thread anonymous via Digitalmars-d-learn
On Saturday, 11 April 2015 at 20:10:49 UTC, Dennis Ritchie wrote: writefln("%(;; %(%s, %),\n%).", [ a[0 .. 15], a[15 .. 30], a[30 .. 45], a[45 .. 60], a[60 .. 75], a[75 .. 90],

Formatted output ranges

2015-04-11 Thread Dennis Ritchie via Digitalmars-d-learn
Hi, Is it possible to write somehow shorter using formatted output and other library functions? - import std.stdio, std.range; void main() { auto a = iota(100, 201); writefln("%(;; %(%s, %),\n%).", [ a[0 .. 15], a[15 .. 30],