Fórum Como remover ultimo nome em um caminho de diretório??? #256746
31/10/2004
0
vCaminho := c:\delphi\teste\tudook
gostaria de que a variável vCaminho ficasse com o valor:
vCaminho := c:\delphi\teste
Emir Neto
Curtir tópico
+ 0Posts
01/11/2004
Reginaldo174
Gostei + 0
01/11/2004
Emir Neto
Gostei + 0
02/11/2004
Tatuweb
function GetPathFolder (Path: string): string; var LenPath, i, j: Word; begin LenPath := Length (Path); if Pos (´\´, Path) = 0 then begin Result := ´Erro: Caminho Inválido!´; Exit; end; if LenPath = 3 then begin Result := Path; Exit; end; if Copy (Path, LenPath, 1) = ´\´ then Path := Copy (Path, 1, LenPath - 1); for i := 0 to LenPath do if Path[i] = ´\´ then j := i; Result := Copy (Path, 1, j); end;
e para chamar:
ShowMessage (GetPathFolder (´c:\delphi\teste\tudook´));
Gostei + 0
02/11/2004
Emir Neto
Gostei + 0
Clique aqui para fazer login e interagir na Comunidade :)