22 lines
541 B
Plaintext
22 lines
541 B
Plaintext
-- Note: currently does not support extra white space in input string
|
|
on expandRange (str)
|
|
res = ""
|
|
_player.itemDelimiter = ","
|
|
cnt = str.item.count
|
|
repeat with i = 1 to cnt
|
|
part = str.item[i]
|
|
pos = offset("-", part.char[2..part.length])
|
|
if pos>0 then
|
|
a = integer(part.char[1..pos])
|
|
b = integer(part.char[pos+2..part.length])
|
|
repeat with j = a to b
|
|
put j&"," after res
|
|
end repeat
|
|
else
|
|
put part&"," after res
|
|
end if
|
|
end repeat
|
|
delete the last char of res
|
|
return res
|
|
end
|