Board index » cppbuilder » TStringList->Sorted How Change the Sort Order?

TStringList->Sorted How Change the Sort Order?

I am using the TStringList to sort the contains of a text file.
The TStringList use only one sort order, so is there a way to change this
sort order?
___________________________
TStringList *pList = new TStringList();

   pList->LoadFromFile("Input.Txt");
   pList->Sorted = true;//
   pList->SaveToFile("Output.Txt");

 delete pList;
___________________________

Thanks.
Sam
skne...@biosys.net

 

Re:TStringList->Sorted How Change the Sort Order?


Quote
: "Sam" <skne...@biosys.net> wrote:
>The TStringList use only one sort order, so is there a way to change this
>sort order?

No, there is no way to do this yet in BCB4.

--
General information:
  * Post to the right group - http://www.borland.com/newsgroups/
    * Do not cross- or multipost
      * Research at http://www.mers.com/searchsite.html

Stefan Hoffmeister - http://www.econos.de/
(TeamB - http://www.teamb.com/)

Re:TStringList->Sorted How Change the Sort Order?


Quote
> No, there is no way to do this yet in BCB4.

    Thank you for your quick reply !

Sam

Stefan Hoffmeister (TeamB) <Stefan.Hoffmeis...@Econos.de> a crit dans le
message : p2od3sc5k9phaok3vhohb3aapct96lu...@4ax.com...

Quote
> : "Sam" <skne...@biosys.net> wrote:

> >The TStringList use only one sort order, so is there a way to change this
> >sort order?

> No, there is no way to do this yet in BCB4.

> --
> General information:
>   * Post to the right group - http://www.borland.com/newsgroups/
>     * Do not cross- or multipost
>       * Research at http://www.mers.com/searchsite.html

> Stefan Hoffmeister - http://www.econos.de/
> (TeamB - http://www.teamb.com/)

Re:TStringList->Sorted How Change the Sort Order?


Hi, Sam!

What do you mean by "Change the sort order"?

Do you have fields in the incoming string that you want to sort by? If
so, to change the sort order, parse each line and recreate it with the
desired field at the front.

Or use TList and pass a custom comparison function to the Sort method.

Hope this helps.

------
Mark Cashman (TeamB - C++ Builder), creator of The Temp{*word*203}Doorway at
http://www.temporaldoorway.com
- Original digital art, writing, music and more -
C++ Builder / JBuilder Tips and The C++ Builder Programmer's Webring
(Join us!)
http://www.temporaldoorway.com/programming/index.htm
------

Other Threads