Data update
This commit is contained in:
parent
796d366b97
commit
35bcdeebf8
504 changed files with 7045 additions and 610 deletions
55
Task/Align-columns/EasyLang/align-columns.easy
Normal file
55
Task/Align-columns/EasyLang/align-columns.easy
Normal file
|
|
@ -0,0 +1,55 @@
|
|||
global width inp$[] .
|
||||
proc read . .
|
||||
repeat
|
||||
inp$ = input
|
||||
until inp$ = ""
|
||||
inp$[] &= inp$
|
||||
ar$[] = strsplit inp$ "$"
|
||||
for s$ in ar$[]
|
||||
width = higher width len s$
|
||||
.
|
||||
.
|
||||
.
|
||||
call read
|
||||
#
|
||||
proc out mode . .
|
||||
for inp$ in inp$[]
|
||||
ar$[] = strsplit inp$ "$"
|
||||
for s$ in ar$[]
|
||||
spc = width - len s$ + 1
|
||||
if mode = 1
|
||||
write s$
|
||||
for i to spc
|
||||
write " "
|
||||
.
|
||||
elif mode = 2
|
||||
for i to spc
|
||||
write " "
|
||||
.
|
||||
write s$
|
||||
elif mode = 3
|
||||
for i to spc div 2
|
||||
write " "
|
||||
.
|
||||
write s$
|
||||
for i to spc - spc div 2
|
||||
write " "
|
||||
.
|
||||
.
|
||||
.
|
||||
print ""
|
||||
.
|
||||
.
|
||||
call out 1
|
||||
print ""
|
||||
call out 2
|
||||
print ""
|
||||
call out 3
|
||||
#
|
||||
input_data
|
||||
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.
|
||||
Loading…
Add table
Add a link
Reference in a new issue