aspose file tools*
The moose likes Beginning Java and the fly likes sorting Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "sorting" Watch "sorting" New topic
Author

sorting

vasu kasukurthi
Greenhorn

Joined: Dec 14, 2009
Posts: 9
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

Joined: Oct 13, 2005
Posts: 36478
    
  16
Have you tried a Comparator? Have you written down on paper what the rules are to provide a "natural ordering"?
Patricia Samuel
Ranch Hand

Joined: Sep 12, 2007
Posts: 300
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.....
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: sorting
 
Similar Threads
Can we format data in message frames?
I think Sun should kill this exam...
deleted flag in string array in B&S
set the values
length function for string