I have a combobox that I read a directory and bring the names of the files found:
output:
demons.txt
arch.txt
elo.txt
So far so good,
but I do not want the combobox to appear in .txt
, how do you remove it?
I have a combobox that I read a directory and bring the names of the files found:
output:
demons.txt
arch.txt
elo.txt
So far so good,
but I do not want the combobox to appear in .txt
, how do you remove it?
You can use the TPath.GetFileNameWithoutExtension
function:
Uses
IOUtils;
// ....
procedure TForm1.FormCreate(Sender: TObject);
const
Arquivos: array[1..3] of string = ('demons.txt ','arch.txt ','elo.txt');
Var
Arquivo: String;
begin
ComboBox1.Clear;
For Arquivo in Arquivos do
begin
ComboBox1.Items.Add(TPath.GetFileNameWithoutExtension(Arquivo));
end;
end;