Range modifications: Difference between revisions
Content added Content deleted
m (fix typo) |
m (→{{header|Phix}}: moved a printf(), added ^^ markers) |
||
Line 438: | Line 438: | ||
if match("Start with",ti) then |
if match("Start with",ti) then |
||
{{range}} = scanf(ti,"Start with \"%s\"") |
{{range}} = scanf(ti,"Start with \"%s\"") |
||
⚫ | |||
ranges = split(range,",") |
ranges = split(range,",") |
||
ranges = vslice(apply(true,scanf,{ranges,{"%d-%d"}}),1) |
ranges = vslice(apply(true,scanf,{ranges,{"%d-%d"}}),1) |
||
⚫ | |||
-- ^^ ^^ |
|||
else |
else |
||
{{string op, integer v}} = scanf(trim(ti),"%s %d") |
{{string op, integer v}} = scanf(trim(ti),"%s %d") |
||
Line 447: | Line 448: | ||
range = join(apply(true,sprintf,{{"%d-%d"},ranges}),",") |
range = join(apply(true,sprintf,{{"%d-%d"},ranges}),",") |
||
printf(1," %9s %2d -> \"%s\"\n",{op,v,range}) |
printf(1," %9s %2d -> \"%s\"\n",{op,v,range}) |
||
-- ^^ ^^ |
|||
end if |
end if |
||
end for</lang> |
end for</lang> |
||
{{out}} |
{{out}} |
||
<small>(Note that all double-quotes in the output were deliberately added in the last two printf() statements, mainly to prove there are no unnecessary spaces, etc, and |
<small>(Note that all double-quotes in the output were deliberately added in the last two printf() statements, mainly to prove there are no unnecessary spaces, etc, and are (see ^^) obviously trivial to remove.)</small> |
||
<pre> |
<pre> |
||
New start range: "" |
New start range: "" |