Essa função formata Cpf/Cnpj sem q o usuario tenha q digitar os pontos, traços e barra
function TfrmFuncoesProcedures.FazDoc(fDoc: String): String; Var vTam, xx : Integer;
vDoc : String; begin
vTam := Length(fDoc); For xx := 1 To vTam Do If (Copy(fDoc,xx,1) <> '.') And (Copy(fDoc,xx,1) <> '-') And (Copy(fDoc,xx,1) <> '/') Then
vDoc := vDoc + Copy(fDoc,xx,1);
fDoc := vDoc;
vTam := Length(fDoc);
vDoc := '';
vDoc := ''; For xx := 1 To vTam Do begin
vDoc := vDoc + Copy(fDoc,xx,1); If vTam = 11 Then begin If (xx in [3,6]) Then vDoc := vDoc + '.'; If xx = 9 Then vDoc := vDoc + '-'; end; If vTam = 14 Then begin If (xx in [2,5]) Then vDoc := vDoc + '.'; If xx = 8 Then vDoc := vDoc + '/'; If xx = 12 Then vDoc := vDoc + '-'; end; end;
Result := vDoc; end;