Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

xiaohuli170

macrumors newbie
Original poster
Jan 13, 2009
27
0
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

macrumors 68040
Jan 10, 2005
3,182
3
Dallas, TX
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

macrumors 6502a
Oct 29, 2006
807
0
Virginia
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.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.