PDA

View Full Version : How to add these object with name to the array by this order?




xiaohuli170
Apr 13, 2009, 10:07 PM
I have some object with name , just like button 1 , button 2 , button 11 ,button 111 , I want to add this object to a array by this order: button 1 ,button 2 , button 11 , button 111, but I found that these object can add the array by thhis order: button 1 , button 11,button 111 , button 2.why ? Thank you for your answer!



lee1210
Apr 13, 2009, 10:15 PM
Are you sorting before you insert or inserting then sorting? The issue is that a lexicographical sort instead of a numeric sort on the second "token". You should have options on sorting this differently. What are you using to sort now?

-Lee

eddietr
Apr 13, 2009, 10:16 PM
You can add items to an array in whatever order you like.

If you post the code you used to add these items, someone can point out why it didn't work as you expected.