Align columns: Difference between revisions

m
Line 1,269:
Declare as Numeric ( fd, i, index, max token )
as Numeric ( num tokens, size Column, tCells, nMaxValue )
as Alpha ( line )
as Numeric ( display Left, display Right, display Center )
as Stack ( maxSize )
GetParam(script, file to edit, separator)
Line 1,289 ⟶ 1,288:
When( File Error ){ Stop }
 
index=1, max token = 0
While Not Eof(fd)
Take ( ReadRow(MAX_LINE)(fd) »and Copy to (line) ),; get Length, and Move to (num tokens)
Set Interval [index, 1:num tokens]; Take( line ) and SPut(cells)
When ( var( max token) Is Lt (num tokens) ) { max token = num tokens }
Line 1,297 ⟶ 1,296:
Wend
Close(fd)
Token Sep (",")
 
// formatting...
For Up( i:=1, max token, 1 )
Set Interval [1:end,i], and Let ( nMaxValuesize Column := MaxValue( Len(SGetGet(cells)) ) Plus(1) )
TakeLet ( nMaxValuetCells ), and Push:= Get( maxSizecells) )
Next
 
For Up( i:=1, max token, 1 )
Let ( size Column := QPop(maxSize) )
Let ( tCells := [1:end,i]Get(cells) )
LPad$( " ", size Column, tCells ), and Put(display Left)
RPad$( " ", size Column, tCells ), and Put(display Right)
CPad$( " ", size Column, tCells ), and Put(display Center)
Next
 
// display:
Token Sep ("")
543

edits