A catalog tool: listed by construction. A tool built for a request carries the report of its own admission here.
def joinl(xs):
out = ''
first = True
for x in xs:
if first:
out = out + x
first = False
else:
out = out + '\n' + x
return out
def split_on(s, d):
out = []
cur = ''
for ch in s:
if ch == d:
out = out + [cur]
cur = ''
else:
cur = cur + ch
out = out + [cur]
return out
def strip1(l):
while l != '' and (l[0] == ' ' or l[0] == '\t' or l[0] == '\r'):
l = l[1:]
while l != '' and (l[-1] == ' ' or l[-1] == '\t' or l[-1] == '\r'):
l = l[:-1]
return l
def solve(s):
out = []
for f in split_on(s, ','):
out = out + [strip1(f)]
return joinl(out)
8 test cases ship with it; the first three:
| in | out |
|---|---|
eab, hufye ,dqvm,0 | eab hufye dqvm 0 |
wxz, piuyaz ,ypsn,1 | wxz piuyaz ypsn 1 |
vgdzcx, pyq ,xrval,2 | vgdzcx pyq xrval 2 |
GET https://research.zaiba.cloud/api/v1/programs/csv_fields_to_lines
POST https://research.zaiba.cloud/api/v1/programs/csv_fields_to_lines/run
{"input": "…"}
# 200 · X-DeAI-Rail: grant (free within the allowance) · output + signed receipt
GET https://research.zaiba.cloud/api/v1/programs/csv_fields_to_lines/code
# 200 · text/plain · the tool as one Python file, written by the library's authors