Align columns: Difference between revisions
Content added Content deleted
No edit summary |
(J: aesthetic changes) |
||
Line 867:
=={{header|J}}==
'''Solution'''
<lang j>'LEFT CENTER RIGHT'=: i.3
NB.* alignCols v Format delimited text in justified columns
NB. y: text to format
NB. result: literal table▼
NB. rows marked by last character in text
NB. columns marked by $
NB. optional x
alignCols=: verb define
LEFT alignCols y
:
global=. dyad def'9!:x y'each
oldbox=. 6 16 global '';'' NB. save settings
▲ res=. _2{:\ ": <;._2 @:(,&'$');._2 y NB. parse & format text
result
)</lang>
|