The IndexOf
example use the list of the names of the days of the week.
I will use that to ask my question.
You know that the Sunday is the first day of the week or the last day of the week depending on where on earth youre living.
The example used:
days() = Array("Monday","Tuesday","Wednesday","Thursday","Friday")
So, add Sunday to the days array is simple (Insert and Append).
But what if the original array have a misplaced day and I have to replace it at its correct location in the array ?
days() = Array("Monday","Tuesday","Thursday","Wednesday","Friday")
Or:
days() = Array(“Monday”,“Wednesday”,“Tuesday”,“Thursday”,“Friday”)
How do I set the array in the correct order ?
If you do not feel comfortable with the Days of the Week example, you can think at the question if I was working on Genealogy and made a mistake, placing an ancestor at the wrong place:
"John Jones", "Paul Jones", "Ringo Jones", "George Jones"
“Ringo Jones” is misplaces in the array and I want it to be at the last position.
In fact, you may have noticed that, I only want to be able to move an element of the array to one position to the left or to the right.
I slept on this problem yesterday, but the night does not gaves me the solution when I awake earlier today.
(this method works pretty fine, many times, but once in a while it just does not works).
Nota: I was thinking John Paul Jones, and then I called into the Beatles first names ;-
Subconcious at work ?