Align columns: Difference between revisions
Content added Content deleted
(→{{header|TXR}}: Removing. The explicitly stated computed column width requirement makes this impractical for the current implementation of TXR.) |
|||
Line 3,127: | Line 3,127: | ||
justified, $ right $ justified, $ or $ center $ justified $ within $ its $ column. $ $ $ |
justified, $ right $ justified, $ or $ center $ justified $ within $ its $ column. $ $ $ |
||
</pre> |
|||
=={{header|TXR}}== |
|||
{{incorrect|TXR|Does not fulfill the (tightened) task requirements in some way; help the author determine why by updating this message, or, better yet: }} |
|||
Hard-coded column with: |
|||
<lang txr>@(collect) |
|||
@(coll)@{FIELD /[^$]+/}@(end) |
|||
@(end) |
|||
@(output) |
|||
Left justified: |
|||
@ (repeat) |
|||
@ (rep)@{FIELD 15}@(end) |
|||
@ (end) |
|||
Right justified: |
|||
@ (repeat) |
|||
@ (rep)@{FIELD -15}@(end) |
|||
@ (end) |
|||
@(end)</lang> |
|||
Sample run: |
|||
<pre>$ txr align-data.txr align-data |
|||
Left 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. |
|||
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. |
|||
</pre> |
</pre> |
||