is among - problem
Thomas J McGrath III
3mcgrath at adelphia.net
Fri Nov 21 09:47:58 EST 2003
Hello to all of you wonderful REV developers.. :-)
I have a problem where I have a field filled with 3 single digit
numbers per line (210 lines). I wanted to find and delete any lines
that had ALL of the same numbers in it but in any order - so 123 and
213 and 321 and 312 would be duplicates and I would delete all but the
first one.
The only thing I could think of was to convert the list to items with
commas between them and use the "is among" command.
I think I did it right but each time I try this I get different results
from the following script. They are close but different.
I thought I would go with use one line to check all of the other lines
and if a total match is found then delete that line. But looking
through the list that is left over after this runs I still find a bunch
of "duplicates" - 1,3,2 and later on a 3,1,2 which should be deleted.
Any ideas what I did wrong??? Or where my square peg thinking got me
into trouble???
Mouse handler with two fields: myList has the list of random numbers
and myCount which holds the final count. I am trying to find an answer
for my daughters Math problem and this is the last part of it.
sort field "myList"
put the number of lines of field "myList" &cr after field "myCount"
repeat with x = 1 to the number of lines in field "myList"
put char 1 of line x of field "myList" & "," into myTemp
put char 2 of line x of field "myList" & "," after myTemp
put char 3 of line x of field "myList" after myTemp
put myTemp into line x of field "myList"
end repeat
repeat with x = 1 to the number of lines in field "myList"
repeat with y = 1 to (the number of lines in field "myList" - 1)
put y + 1 into y
put item 1 of line y of field "myList" into H
put item 2 of line y of field "myList" into I
put item 3 of line y of field "myList" into G
put line x of field "myList" into J
if H is among the items of J then
if I is among the items of J then
if G is among the items of J then
delete line y + 1 of field "myList"
beep
end if
end if
end if
end repeat
Advanced Media Group
Thomas J McGrath III ð 2003 ð 3mcgrath at adelphia.net
220 Drake Road, Bethel Park, PA 15102
More information about the use-livecode
mailing list