Comparing 2 Lists Coldfusion
Posted on 2016-10-08
I have 2 lists with the same numbered elements, just in the 2nd list one list element has moved positions. I need to know how to find the original position of the moved list element (from List1) and the position it moved to (in List2) using Coldfusion. Here is an example
<List1 = '1,2,3,4,5'>
<List2 = '2,3,1,4,5'>
I need to know that "1" in List1 moved to the 3rd position in List2. Couple things to know
1. Each list will have the exact same numbers in them (ie list elements - 1,2,3,4,5), only in a different order
2. Only one list element will move, ie 1 moved to the 3rd position, no other list elements would change.
3. A list element can move forward or backwards, so the "1" could move the the 3rd position or the "5" could have moved to the 2nd position.