I'm doing my homework,that i need to use quick sort to sort string array,and the element in array combing number and string. for example
String s[];
s[0]="172,19,Nina";
s[1]="178,18,Apple";
s[2]="178,18,Alex";
So after sorted, it should be
s[0]=172,19,Nina
s[1]=178,18,Alex
s[2]=178,18,Apple
Im thinking should i split all the Strings first into number and string, and then sort 172,178,178, and then sort 19 18 18, and at the end sort Nina Apple Alex??
what is the best way to do this?
compareTo()method a solution here? Asking this question to people who see this question,not to the OP.