java - How do i make an ascending order an array of strings using the a number within the string? -


i have number example 593, need order these numbers , put them in ascending order. want know how put in ascending order. few lines excel have order.note there 10,000 lines of these.

8/26/2012,kristina,h,chung,947 martin ave.,muncie,ca,46489,khchung@business.com, $593  11/16/2012,paige,h,chen,15 mainway rd.,dallas,hi,47281,phchen@business.com, $516  11/10/2012,sherri,e,melton,808 washington way,brazil,ca,47880,semelton@business.com, $80  9/20/2012,gretchen,i,hill,56 washington dr.,atlanta,fl,47215,gihill@business.com, $989  3/11/2012,karen,u,puckett,652 maplewood ct.,brazil,fl,46627,kupuckett@business.com, $826  7/4/2012,patrick,o,song,679 mainway rd.,lafayette,ga,47161,posong@business.com, $652  

after sorted this

11/10/2012,sherri,e,melton,808 washington way,brazil,ca,47880,semelton@business.com, $80 11/16/2012,paige,h,chen,15 mainway rd.,dallas,hi,47281,phchen@business.com, $516 8/26/2012,kristina,h,chung,947 martin ave.,muncie,ca,46489,khchung@business.com, $593 7/4/2012,patrick,o,song,679 mainway rd.,lafayette,ga,47161,posong@business.com, $652 3/11/2012,karen,u,puckett,652 maplewood ct.,brazil,fl,46627,kupuckett@business.com, $826 9/20/2012,gretchen,i,hill,56 washington dr.,atlanta,fl,47215,gihill@business.com, $989

but need know how code this.

some line of code: string holder2; arraylist persons = new arraylist<>();

    for(int = 0; < listofcustomers.length; i++)     {         holder2 = listofcustomers[i];         persons.setdata(holder2);        }       collections.sort(persons);  } 

here's how go :

  1. store these lines in srting array or arraylist
  2. for each line, find position of $ string's chatat() method , extract number out of string
  3. store these strings in map, key designating line number, , value number extracted in #2
  4. sort map according values given here
  5. now have map sorted according values , keys represent sorting order of lines!

Comments

Popular posts from this blog

PHPMotion implementation - URL based videos (Hosted on separate location) -

javascript - Using Windows Media Player as video fallback for video tag -

c# - Unity IoC Lifetime per HttpRequest for UserStore -