•
•
•
•
What is DaniWeb IT Discussion Community?
You're currently browsing the Java section within the Software Development category of DaniWeb, a massive community of 425,866 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 2,483 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our Java advertiser: Lunarpages Java Web Hosting
This class will sort strings in alphabetical order.
public class SortArrayString { public static void sortEm(String [] array, int len) { int a,b; String temp; int sortTheStrings = len - 1; for (a = 0; a < sortTheStrings; ++a) for (b = 0; b < sortTheStrings; ++b) if(array[b].compareTo(array[b + 1]) >0) { temp = array[b]; array[b] = array[b + 1]; array[b + 1] = temp; } } }
Comments (Newest First)
alpe gulay | Light Poster | May 16th, 2008
•
•
•
•
..its good to see how really sorting goes on!..
if we use java.util.Arrays.sort(array);
it makes us faster and easier!.,..
yah its much easier but this one is good to letting know your self on how sorting goes on!!
this help most students like me!!!..
well, its up to you on what you better used to be,.
the point is you understand how it goes like that and goes like this and so on and so for.....,;
if we use java.util.Arrays.sort(array);
it makes us faster and easier!.,..
yah its much easier but this one is good to letting know your self on how sorting goes on!!
this help most students like me!!!..
well, its up to you on what you better used to be,.
the point is you understand how it goes like that and goes like this and so on and so for.....,;
cscgal | The Queen of DaniWeb | Mar 31st, 2006
•
•
•
•
Why did you have to register? Guests have the ability to view code snippets and comments.
agent_x91 | Newbie Poster | Dec 9th, 2005
•
•
•
•
Hah... I had to register to this website just to find out that I can use an already existing method to sort Strings into alphabetical order... thanks jwenting.
jwenting | duckman | Feb 9th, 2005
•
•
•
•
A far easier implementation is as follows:
public static void sortEm(String[] array, int len)
{
java.util.Arrays.sort(array);
} cscgal | The Queen of DaniWeb | Sep 20th, 2004
•
•
•
•
Thank you.
Post Comment
•
•
•
•
DaniWeb Marketplace (Sponsored Links)