This class will sort strings in alphabetical order.
Sorting Strings
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;
}
}
}
Dani 4,329 The Queen of DaniWeb Administrator Featured Poster Premium Member
jwenting 1,889 duckman Team Colleague
agent_x91 0 Newbie Poster
Dani 4,329 The Queen of DaniWeb Administrator Featured Poster Premium Member
alpe gulay -1 Light Poster
madaapril 0 Newbie Poster
JamesCherrill 4,733 Most Valuable Poster Team Colleague Featured Poster
pokejef143 0 Newbie Poster
DavidKroukamp 105 Master Poster Team Colleague Featured Poster
shivakr 0 Newbie Poster
JamesCherrill 4,733 Most Valuable Poster Team Colleague Featured Poster
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.