Range modifications: Difference between revisions

m
m (→‎{{header|Phix}}: added high range)
Line 430:
remove 9
remove 7
Start with "13-14,22-22,100000999999-100001000000,100001000003-999999999999"
remove 22
remove 100000999999
remove 100001000000
add 100001000001
add 100001000002
remove 100001000002
remove 100001000001
""","\n",no_empty:=true)
Line 443 ⟶ 445:
string ti = tests[i]
if match("Start with",ti) then
{{range}} = scanf(trim(ti),"Start with \"%s\"")
ranges = split(range,",")
ranges = vslice(apply(true,scanf,{ranges,{"%d-%d"}}),1)
printf(1,"\n Start rangewith: \"%s\"\n",{range})
-- ^^ ^^
else
Line 460 ⟶ 462:
<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>
Start rangewith: ""
add 77 -> "77-77"
add 79 -> "77-77,79-79"
Line 468 ⟶ 470:
remove 79 -> ""
 
Start rangewith: "1-3,5-5"
add 1 -> "1-3,5-5"
remove 4 -> "1-3,5-5"
Line 476 ⟶ 478:
remove 7 -> "1-3,5-6,8-8"
 
Start rangewith: "1-5,10-25,27-30"
add 26 -> "1-5,10-30"
add 9 -> "1-5,9-30"
Line 484 ⟶ 486:
remove 7 -> "1-5,10-25,27-30"
 
Start rangewith: "13-14,22-22,100000999999-100001000000,100001000003-999999999999"
remove 22 -> "13-14,100000999999-100001000000,100001000003-999999999999"
remove 100000999999 -> "13-14,100001000000-100001000000,100001000003-999999999999"
remove 100001000000 -> "13-14,100001000003-999999999999"
add 100001000001 -> "13-14,100001000001-100001000001,100001000003-999999999999"
remove 100001000001 add 100001000002 -> "13-14,100001000001-999999999999"
remove 100001000002 -> "13-14,100001000001-100001000001,100001000003-999999999999"
remove 100001000001 -> "13-14,100001000003-999999999999"
</pre>
 
7,794

edits