Fórum Como separar os nomes de um arquivos no listview? Entre um carácter?? #606465
07/11/2019
0
Estou com um projeto já algum tempo, mas estou atualizando ele para maiores informações na empresa, o que preciso é: quando importar os arquivos (nomes) da música para o listview, ele separe o artista do título, ou por exemplo em uma coluna ele coloca o que está antes do carácter -, e na outra o título, ele coloca o que está depois do carácter -
por exemplo
Blitz - A Dois passos do paraíso
coluna 1 coluna 2
Blitz A dois passos do paraíso
Agradeceria muito pela ajuda desta função.
Obrigado a todos.
Júnior Pinheiro
Curtir tópico
+ 0Posts
25/11/2019
Júnior Pinheiro
function artista(pStrValue: string): string;
var
sArtista : string;
i: Integer;
begin
if sArtista = '' then
begin
result := copy (pStrValue,1, Length(pStrValue)-4);
for I := 1 to length(pStrValue) do
begin
if ((pStrValue[i] = '-') and
(pStrValue[i-1] = ' ') and
(pStrValue[i+1] = ' ')) then
begin
if length(pStrValue) > (i+4) then
begin
result := trim(copy (pStrValue,1,i-1))
end;
end;
end;
end;
end;Gostei + 0
27/11/2019
Júnior Pinheiro
Resolvido.
function artista(pStrValue: string): string;
var
sArtista : string;
i: Integer;
begin
if sArtista = '' then
begin
result := copy (pStrValue,1, Length(pStrValue)-4);
for I := 1 to length(pStrValue) do
begin
if ((pStrValue[i] = '-') and
(pStrValue[i-1] = ' ') and
(pStrValue[i+1] = ' ')) then
begin
if length(pStrValue) > (i+4) then
begin
result := trim(copy (pStrValue,1,i-1))
end;
end;
end;
end;
end;Gostei + 0
Clique aqui para fazer login e interagir na Comunidade :)