---------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------
-- SORT OUT
--
-- Use repeatloops to sort the numbers (or letters)
-- in a field.
--
--
-- Kurt * Belgium 05/15/2001
--
---------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------
on mouseup me
-- the number of characters to sort
AMOUNT = (member "Input").chars.count
--The number of times the loop will be repeated = COUNTER
COUNTER = 1
-- The number of times compared to the number of characters
repeat while COUNTER <= AMOUNT
-- The position of an element
POS = 1
REMAIN = AMOUNT - COUNTER
repeat while POS <= REMAIN
--if an element is bigger than the next element, it is placed in a
--helpvariable,then the position of the two elements is switched.
if (member "Input").char[POS] > (member "Input").char[POS + 1] then
HELP = (member "Input").char[POS]
(member "Input").char[POS] = (member "Input").char[POS + 1]
(member "Input").char[POS + 1] = HELP
end if
POS = POS + 1
end repeat
COUNTER = (COUNTER + 1)
end repeat
end
Contact
MMI
36 South Court Sq
Suite 300
Newnan, GA 30263
USA