File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Beginning Java and the fly likes Sorting of string elements in alphabetical order Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Sorting of string elements in alphabetical order" Watch "Sorting of string elements in alphabetical order" New topic
Author

Sorting of string elements in alphabetical order

lmahesh kumar
Greenhorn

Joined: Feb 27, 2003
Posts: 15
Hi,

I am having an string array of some size.
\
I want to sort in alphabetical order .

Pls give me the logic or simple example .



ThankS.
Mahesh L.
=========
Michael Dunn
Ranch Hand

Joined: Jun 09, 2003
Posts: 4632
Collections.sort(Arrays.asList(yourArray));
David Harkness
Ranch Hand

Joined: Aug 07, 2003
Posts: 1646
Or Arrays.sort(array). There's a version that takes a Comparator if you need to do case-insensitive sorting: Arrays.sort(array, String.CASE_INSENSITIVE_ORDER).
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Sorting of string elements in alphabetical order