TStringListSorted (C++)
Description
This example uses a list box on a form. When the application runs, a string list object is created and three strings are added to it. The strings are sorted and added to the list box, where they appear in their sorted order.
Code
#include <memory> //For STL auto_ptr class
__fastcall TForm1::TForm1(TComponent* Owner)
: TForm(Owner)
{
std::auto_ptr<TStringList> list(new TStringList());
list->Add("Plants");
list->Add("Animals");
list->Add("Minerals");
list->Sorted = true;
ListBox1->Items->AddStrings(list.get());
}
Uses
- System.Classes.TStringList.Sorted ( fr | de | ja )
- System.Classes.TStrings.AddStrings ( fr | de | ja )