Align columns: Difference between revisions

Content added Content deleted
(→‎{{header|D}}: fix this example, my bad on the original)
(→‎{{header|D}}: update with output and a comment about options)
Line 552: Line 552:


=={{header|D}}==
=={{header|D}}==
This example allows selection of right- and left-favoring center alignments, defaulting to left-favoring center alignment.

<lang d>
<lang d>
import std.stdio;
import std.stdio;
Line 626: Line 626:
}
}
</lang>
</lang>

<pre>
Given a text file of many lines, where fields within a line
are delineated by a single 'dollar' character, write a program
that aligns each column of fields by ensuring that words in each
column are separated by at least one space.
Further, allow for each word in a column to be either left
justified, right justified, or center justified within its column.
Given a text file of many lines, where fields within a line
are delineated by a single 'dollar' character, write a program
that aligns each column of fields by ensuring that words in each
column are separated by at least one space.
Further, allow for each word in a column to be either left
justified, right justified, or center justified within its column.
Given a text file of many lines, where fields within a line
are delineated by a single 'dollar' character, write a program
that aligns each column of fields by ensuring that words in each
column are separated by at least one space.
Further, allow for each word in a column to be either left
justified, right justified, or center justified within its column.
</pre>


=={{header|E}}==
=={{header|E}}==