我想写一个检查程序。
如果列表1中包含列表2中的项目,则检查下一个项目。如果不包括在内,则将此项目写入列表1。
set list_1 to {"万", "历", "阞", "劜", "办", "劝", "功", "加", "劢", "务", "动", "劣", "劤", "劥", "劦", "劧", "助", "劫", "劲", "劳", "励", "努", "劬", "劭", "労", "劰", "劮", "劯", "劾", "劼", "劻", "势", "効", "劷", "劵", "劶", "勆", "劽", "劺", "劸", "勃", "勉", "勋", "勇", "勅", "勁", "勂", "勀", "勊", "勄", "勈", "勐", "勍", "勑", "勌", "勏", "勎", "勒", "勔", "勖", "勚", "動", "勓", "募", "勛", "勞", "勜", "勤", "勣", "勢", "勦", "勠", "勡", "勧", "勨", "勩", "勱", "勥", "勭", "勫", "勪", "勬", "勲", "勯", "勮", "勵", "勳", "勶", "勴", "勷", "勸", "仂", "伤", "艻", "边", "夯", "叻", "另", "屴", "饬", "扐", "抛", "拋", "氻", "忇", "幼", "爋", "朸", "牞", "玏", "朂", "肋", "攰", "男", "穷", "虏", "糼", "竻", "觔", "辦", "赲", "釛", "飭", "鳨", "", "为"}
set list_2 to {"勇", "勫", "陸", "無", "給", "個", "幫", "爸", "姐"}
set numbet_ to 1
repeat
try
repeat
set get_ to get item number_ of list_2
if list_1 contains get_ then
set numbet_ to number_ + 1
exit repeat
else if list_1 does not contain get_ then
set end of words_contained_in_piangpangwubi_and_pianpangcheshi to x4
set numbet_ to number_ + 1
exit repeat
end if
end repeat
on error
exit repeat
end try
end repeat
list_1
答案 0 :(得分:0)
to putItems from M into L
if M = {} then return
script
property array : L
property list : M
end script
tell the result
set [x, x_] to [item 1, rest] of its list
if x is not in its array then set end of its array to x
putItems from x_ into its array
end tell
end putItems
然后:
putItems from list_2 into list_1
list_1
答案 1 :(得分:0)
尽管我不知道您的程序是否对列表项的数量有限制。但是,如果我使用这样的程序,它不会出错。你可以看看
set words_contained_in_piangpangwubi to {"万", "历", "阞"}
set words_contained_in_piangpangwubi to {"万", "为", "历"}
repeat with item_number in words_contained_in_piangpangcheshi
set booleanlist to {}
repeat with item_number_2 in words_contained_in_piangpangwubi
if contents of item_number_2 is not contents of item_number then
set end of booleanlist to true
end if
if contents of item_number_2 is contents of item_number then
set end of booleanlist to false
end if
end repeat
set booleanlist_number to 0
repeat with booleanlist_number_2 in booleanlist
if contents of booleanlist_number_2 is true then
set booleanlist_number to booleanlist_number + 1
end if
if contents of booleanlist_number_2 is false then
exit repeat
end if
end repeat
if booleanlist_number = (count item of words_contained_in_piangpangwubi) then
set end of words_contained_in_piangpangwubi to contents of item_number
end if
end repeat
words_contained_in_piangpangwubi