File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

sorting

 
vasu kasukurthi
Greenhorn
Posts: 9
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i have data in a file like
1,2,3,1WM,1WM5,1WM2,15MN,15MN10,9MN,9MN1,
11XL,11XL2,5XX,1MN,1MN2,1LM

i have to read data and need to sort like the following
1,1LM,1MN,1MN2,1WM,1WM5,2,3,5XX,9MN,9MN1,11XL,11XL2,15MN,15MN10

Please can any one help me.
 
Campbell Ritchie
Sheriff
Pie
Posts: 47250
52
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Have you tried a Comparator? Have you written down on paper what the rules are to provide a "natural ordering"?
 
Patricia Samuel
Ranch Hand
Posts: 300
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes, you have to use Comparator for that purpose and the logic could be like you have to get substring and then have to sort those parts.....
 
Don't get me started about those stupid light bulbs.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic