Align columns: Difference between revisions

m
→‎{{header|Snobol}}: Output now doesn't force all fields on each line with trailing all-space columns.
(→‎{{header|Snobol}}: Just track column width as text is read in instead of in a second loop; improve comments.)
m (→‎{{header|Snobol}}: Output now doesn't force all fields on each line with trailing all-space columns.)
Line 8,047:
 
{{Out}}
<pre>Left-justified:
Left-justified:
Given a text file of many lines, where fields within a line
areGiven a delineated by text a file single 'dollar' of character, write many a lines, program where fields within a line
thatare aligns delineated by each column of fields by a single ensuring'dollar' that character, write words a in each program
columnthat are aligns each separated by column at least one space.of fields by ensuring that words in each
Further,column allow are for separated by each wordat in a column least to one be eitherspace. left
justifiedFurther, right allow justified, or for center justified within each itsword in column. a column to be either left
justified, right justified, or center justified within its column.
 
Right-justified:
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.
 
Centered:
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|Standard ML}}==
1,479

edits