09-16-2013 09:39 AM
Hello to all,
I would like to ask you a question.
I need to sort an array of numbers and strings.
Can I sort the array by name?
09-16-2013 09:55 AM
What do you mean "sort the array by name"? What name are you talking about?
09-16-2013 10:01 AM
You're right. Forgive me.
For example I have:
Roma 9
Roma 8
Milano 8
Florence 9
Florence 20
Venice 10
I would like Milan, Venice, Florence and Rome ...
is it possible?
09-16-2013 10:06 AM
Build a new array that strips out the numbers. I'm sure there is a way to do a Regex that does it. Or you could search for the space assuming you never have a name that has a space in it.
Then sort that array. Then removed the duplicates. (Search the forums because there have been many posts that discuss ways to remove duplicate entries.)
(Though I am not sure about your sorting because it should be Florence, Milan, Rome, Venice). (And do you want Rome or Roma? Milan or Milano?)
09-16-2013 10:34 AM
I'm sorry, I explained I was wrong or inaccurate.
I enclose the table (array) I want to reorder.
Assuming that the column "Tratta" may have also different elements (not just Piacenza - Parma), I would be able to sort the table by clicking one of the elements of the columns (for example: sort the table by "Tratta" or by "Km", etc )
09-16-2013 11:12 AM
This is really a completely different question than what you originally described. Now you are trying to sort a 2-D array based on different columns.