Results 1 to 4 of 4

Thread: Sorting an array.

  1. #1

    Thread Starter
    Fanatic Member vijy's Avatar
    Join Date
    May 2007
    Location
    India
    Posts
    548

    Sorting an array.

    i have a array like below.

    Code:
    Dim sTemp() as string={"CCC1", "CCCs10", "CCCx11", "CsCC2", "CffffCC3"}
    I have to sort this array depends on the prefix(nymber)

    Code:
    sTemp() ={"CCC1", "CsCC2", "CffffCC3", "CCCs10", "CCCx11"}
    any help pls...
    Last edited by vijy; Jul 7th, 2009 at 05:58 AM.
    Visual Studio.net 2010
    If this post is useful, rate it


  2. #2
    PowerPoster Nitesh's Avatar
    Join Date
    Mar 2007
    Location
    Death Valley
    Posts
    2,556

    Re: Sorting an array.

    look at the array.sort method

  3. #3

    Thread Starter
    Fanatic Member vijy's Avatar
    Join Date
    May 2007
    Location
    India
    Posts
    548

    Re: Sorting an array.

    Array.Sort returning the same as input..
    Visual Studio.net 2010
    If this post is useful, rate it


  4. #4
    PowerPoster
    Join Date
    Apr 2007
    Location
    The Netherlands
    Posts
    5,070

    Re: Sorting an array.

    If you want it to sort on the number, and not on the rest of the text, you can create your own comparer.

    There's an excellent explanation + example at jmcilhinney's blog:
    http://jmcilhinney.blogspot.com/2009...ns-part-1.html

Posting Permissions

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



Click Here to Expand Forum to Full Width