Ver Mensaje Individual
  #2  
Antiguo 29-06-2014
Avatar de ecfisa
ecfisa ecfisa is offline
Moderador
 
Registrado: dic 2005
Ubicación: Tres Arroyos, Argentina
Posts: 10.508
Reputación: 36
ecfisa is a splendid one to beholdecfisa is a splendid one to beholdecfisa is a splendid one to beholdecfisa is a splendid one to beholdecfisa is a splendid one to beholdecfisa is a splendid one to beholdecfisa is a splendid one to behold
Hola eennzzoo.

Código:
String SortString(String Str)
{
  TStringList *TS = new TStringList;

  TS->DelimitedText = Str;
  TS->Sort(); 
  Str = "";
  for(int i=0;i<TS->Count;i++) Str += TS->Strings[i] + ' ';
  delete TS;
  Str.SetLength(Str.Length()-1);

  return Str;
}
Ejemplo de uso:
Código:
void __fastcall TForm1::Button1Click(TObject *Sender)
{
  TStrings *TS = new TStringList;
  TS->LoadFromFile("tu_archivo.txt");

  ListBox1->Items->Add(TS->Strings[0]);        // A02 A00 A01
  TS->Strings[0] = SortString(TS->Strings[0]); // ordenar
  ListBox1->Items->Add(TS->Strings[0]);        // A00 A01 A02
  ...
  delete TS;
}
Saludos
__________________
Daniel Didriksen

Guía de estilo - Uso de las etiquetas - La otra guía de estilo ....
Responder Con Cita