CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 4 of 4
  1. #1
    Join Date
    Apr 1999
    Location
    Germany
    Posts
    37

    Sort a CStringArray



    I need to sort a CStringArray...

    Does anyone know an algorithm that does this?


    Thank you in advance!


    Ronny

  2. #2
    Join Date
    Apr 1999
    Location
    UK
    Posts
    3

    Re: Sort a CStringArray



    I have a Sort Class that will sort a CString array both a-z or z-a. Reply to this with your email address and I'll send you the code.


    Cheers

    Andy Pike

  3. #3
    Join Date
    May 1999
    Location
    Bern, Switzerland
    Posts
    12

    Re: Sort a CStringArray



    There is a Visual C++ KB article "How to Sort a CStringArray in MFC". Look for it in the KB.


    Regards. Karl

  4. #4
    Join Date
    May 1999
    Posts
    3

    Re: Sort a CStringArray



    my advise: use Standard C++ template library.

    it would be as simple as

    #include <string>

    #include <vector>

    #include <algorithm>

    using namespace std;

    vector<string> myarray;

    myarray.push_back( "some string"

    myarray.push_back( "some other string"

    .

    .

    .

    sort(myarray.begin(),myarray.end());

    viola. you got a sorted array. with STL containers/algoritms you can do all sort of neat things.




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

Featured