Comparar texto em variavel string
Gostaria de comparar os dados de uma string utilizando a mesma forma do Like do sql. Ex.:
while not Eof(txt) do
begin
ReadLn(txt, line);
if True then
if Trim(line) = LIKE '|0150|' then
end;
Importação do SPED Fiscal, só quero alguns blocos...
while not Eof(txt) do
begin
ReadLn(txt, line);
if True then
if Trim(line) = LIKE '|0150|' then
end;
Importação do SPED Fiscal, só quero alguns blocos...
Pablo Ricardo
Curtidas 0
Respostas
Pablo Ricardo
30/10/2014
ReadLn(txt, line);
if True then
if (pos('|C460|', line)) <> 0 then
ShowMessage(IntToStr(pos('|C460|', line)));
Consegui separar assim... más o pos não me parece recomendado pra isso. Poderia substituir pelo que?
GOSTEI 0
Pablo Ricardo
30/10/2014
procedure TfrmImportacaoSPED.LoadArquivo;
var
txt: TextFile;
line: String;
posicao: Integer;
flag: Boolean;
begin
flag := False;
AssignFile(txt, edtPath.Text);
Reset(txt);
if fArq = nil then
fArq := TStringList.Create
else
fArq.Clear;
fArq.BeginUpdate;
while not Eof(txt) do
begin
ReadLn(txt, line);
if True then
if (pos('|C460|', line)) <> 0 then
begin
fArq.Add(line);
flag := True;
end
else
begin
if flag = True then
fArq.Add(line);
end;
end;
CloseFile(txt);
fArq.EndUpdate;
mmo1.Text := fArq.Text;
FreeAndNil(fArq);
end;Serviu pro que eu to precisando por hora. Muito obrigado.
GOSTEI 0