The way that I would sort the String is to first change it to a character array by using toCharArray() of the String. From there, you could just do a normal sorting algorithm just as if it were numbers...for example:
Code:
for (int i = 0; i < char.length-1; i++) {
if char[i+1] < char[i] {
char temp = char[i];
char[i] = char[i+1];
char[i+1] = temp;
}
}
This hasn't been compiled, so it may have a few errors, possibly an off by one error...I can never get my sorting on the first try. But hope this helps.
Bookmarks