...
/Format Specifiers: Width, Separator, Precision and Flags
Format Specifiers: Width, Separator, Precision and Flags
This lesson explains four more parts of the format specifier: width, separator, precision and flags.
Width #
This part determines the width in characters that the argument is displayed in. If the width is specified as the character *
, then the actual width value is read from the next argument (that argument must be an int
). If width is a negative value, then the -
flag is assumed.
Press + to interact
import std.stdio;void main() {int value = 100;writefln("In a field of 10 characters:%10s", value);writefln("In a field of 5 characters :%5s", value);}
Separator #
...
Access this course and 1400+ top-rated courses and projects.