1-6,11-13,15-22,23-30
List 2
4,7,8,12,20
I want to compare these two lists to pull out 4,12,20 from the 2nd list because they are inside the ranges in the first list. Do i have to use a long method of multiple repeats which id have to build a function for or is there a nice neat way to do it?
my guess is to loop through list 2 and ask if the item is <= item1 of line 1 of list 1 or >= item 2 of line 2 of list 1 and check every item in list 1 and if it proves true add it to a 3rd list. then go to the next item in list 2 and do the same again
my long way around
Code: Select all
put empty into list3
repeat for each item nitem in list2
repeat for each item ritem in list1
set itemDelimiter to "-"
if nitem >= item 1 of ritem AND nitem <= item 2 of ritem then
put nitem and comma after list3
set itemDelimiter to comma
end repeat
end repeat
delete the last char of list3