Results 1 to 3 of 3
  1. #1
    DylanDubya is offline Member
    Join Date
    Dec 2011
    Posts
    7
    Rep Power
    0

    Default 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.

  2. #2
    mp3_1 is offline Member
    Join Date
    Nov 2011
    Posts
    10
    Rep Power
    0

    Default 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?

  3. #3
    DylanDubya is offline Member
    Join Date
    Dec 2011
    Posts
    7
    Rep Power
    0

    Default 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.

Similar Threads

  1. changing letters in strings
    By dienesh77 in forum New To Java
    Replies: 8
    Last Post: 02-17-2011, 01:56 PM
  2. converting letters to numbers
    By fenhoff in forum New To Java
    Replies: 2
    Last Post: 01-24-2010, 04:45 AM
  3. Using Merge Sort to sort an ArrayList of Strings
    By coldfire in forum New To Java
    Replies: 3
    Last Post: 03-13-2009, 01:03 AM
  4. text Strings to produce letters
    By dc2acgsr99 in forum New To Java
    Replies: 7
    Last Post: 01-29-2008, 08:08 PM
  5. validating a string for numbers and letters?
    By lockmac in forum New To Java
    Replies: 1
    Last Post: 08-09-2007, 09:17 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •