Formatted output ranges

Dennis Ritchie via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Sat Apr 11 15:45:36 PDT 2015


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 
width of the line is 30 characters:
-----
(let ((a (loop :for i :from 10 :to 1100 :collect i)))
	(format t "~%;;~{ ~<~%;; ~1,30:;~S~>~^,~}.~%" a))
-----
http://ideone.com/hGguge


More information about the Digitalmars-d-learn mailing list