Skip to content

Instantly share code, notes, and snippets.

@HakierGrzonzo
Created August 21, 2019 17:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save HakierGrzonzo/683209f83accfac48b8550cb880290c0 to your computer and use it in GitHub Desktop.
Save HakierGrzonzo/683209f83accfac48b8550cb880290c0 to your computer and use it in GitHub Desktop.
Program VcardDiv;
uses crt;
var
i:Longint;
Filepath,str:string;
source,dest:textfile;
Begin
writeln('VcardDiv v0.1');
writeln('enter source filename:');
readln(Filepath);
try
begin
assign(source,Filepath);
reset(source);
i := 0;
repeat
readln(source,str);
case str of
'BEGIN:VCARD' : begin
assign('./result/Card'+inttostr(i)+'.vcf',dest);
rewrite(dest);
writeln(dest,str);
i := i+1;
clrscr;
writeln('VCARD no: '+inttostr(i))
end;
'END:VCARD': begin writeln(dest,str); closefile(dest); end;
else
begin
writeln(dest,str);
end;
end;
until eof(source);
writeln(inttostr(i)+' cards split');
writeln('The split cards were saved in ./result');
closefile(source);
end;
except
on E: Exception do
writeln( 'Error: '+ E.ClassName + #13#10 + E.Message );
end;
end.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment