How can I sort an array of strings that contain numbers, letters and dashes?
I am a student and cannot use one of java's built in sort methods. The strings are in the format LDD-DDDDD, where L can be a letter B,M or P.
D represents a digit. i.e. B09-00002. Our teacher has specified that we must use the "selection sort" method for sorting integers and modify it to work in this situation. There are several other parts to the program that I have already done, but I can't think my way through this one. Please help me, I have to take my final in 2 days (well one now), and I haven't been able to study because I am so busy trying to finish this last assignment. Please try to go in depth, as I really need to understand how to do this.
Re: How can I sort an array of strings that contain numbers, letters and dashes?
do you mean by using substring and indexof methods and such?
Re: How can I sort an array of strings that contain numbers, letters and dashes?
Well our teacher says we can only use methods that we have been taught in class and I dunno if we have learned either of those. What would be the specific keywords for those? I think we have to compare each string by breaking it down into characters and comparing them but I'm not sure.