Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- {#################################################
- # Aby usunac wszystkie polskie znaki z pliku, #
- # nalezy wkleic zawartosc pliku, do pliku #
- # napisy.txt, a nastepnie odpalic program #
- # polskieZnaki.exe #
- # autor: asmodeus94 #
- #################################################}
- program polskieZnaki;
- uses crt,dos;
- var t,t2 : text;
- zs,podp,linia : string;
- pusty,byl,x,y,jestRozsz : byte;
- ile,aktIle : integer;
- const s = 'napisy.txt';rozsz='txt';
- procedure ogonki;
- begin
- if linia[x] = 'ą' then linia[x]:='a';
- if linia[x] = 'Ą' then linia[x]:='A';
- if linia[x] = 'ę' then linia[x]:='e';
- if linia[x] = 'Ę' then linia[x]:='E';
- if linia[x] = 'ś' then linia[x]:='s';
- if linia[x] = 'Ś' then linia[x]:='S';
- if linia[x] = 'ć' then linia[x]:='c';
- if linia[x] = 'Ć' then linia[x]:='C';
- if (linia[x] = 'ż')OR(linia[x] = 'ź') then linia[x]:='z';
- if (linia[x] = 'Ż')OR(linia[x] = 'Ź') then linia[x]:='Z';
- if linia[x] = 'ń' then linia[x]:='n';
- if linia[x] = 'Ń' then linia[x]:='N';
- if linia[x] = 'ł' then linia[x]:='l';
- if linia[x] = 'Ł' then linia[x]:='L';
- if linia[x] = 'ó' then linia[x]:='o';
- if linia[x] = 'Ó' then linia[x]:='O';
- end;
- begin clrscr;
- if fSearch(s,'') = '' then begin
- write('Plik ',s,' nie istnieje...');readkey;clrscr;
- assign(t,s);
- rewrite(t);
- close(t);
- writeln('Plik ',s,' zostal utworzony. Teraz mozesz wkleic tam napisy.');readkey;
- end;
- pusty:=1;
- assign(t,s);
- reset(t);
- ile:=0;
- REPEAT
- ile:=ile+1;
- readln(t,linia);
- if (linia<>'')AND(linia<>' ') then begin pusty:=0;end;
- UNTIL eof(t);
- close(t);
- if pusty=1 then begin clrscr;textbackground(7);textcolor(red);write('Plik napisy.txt jest pusty');readkey;exit;end;
- write('Jedna linijka nie moze zawierac wiecej niz 255 znakow!'); readkey;
- REPEAT clrscr;writeln('Nazwa pliku wyjsciowego (s - nazwa standardowa): ');REPEAT write('>');readln(zs);UNTIL (zs<>'')OR(zs='cls');UNTIL zs<>'cls';
- if zs = 's' then zs:='napisyP.txt';clrscr;
- jestRozsz:=0;x:=0;
- REPEAT
- x:=x+1;y:=0;
- REPEAT
- y:=y+1;
- if zs[x+y-1]=rozsz[y] then jestRozsz:=1 ELSE begin jestRozsz:=0;break;end;
- UNTIL y=3;
- UNTIL (x=length(zs))OR(jestRozsz=1);
- if jestRozsz=0 then zs:=zs+'.txt';
- x:=0;byl:=0;
- REPEAT
- x:=x+1;
- if zs[x]='\' then byl:=1;
- UNTIL (x=length(zs))OR(byl=1);
- if byl=0 then podp:='w aktualnym katalogu' ELSE podp:='w nastepujacej lokalizacji';
- assign(t,s);
- assign(t2,zs);
- reset(t);
- rewrite(t2);
- aktIle:=0;
- REPEAT
- aktIle:=aktIle+1;
- readln(t,linia);
- for x:=1 to length(linia) do begin
- ogonki;
- end;
- if (aktIle<>ile)AND(aktIle<>1) then writeln(t2,''); write(t2,linia);
- UNTIL eof(t);
- close(t);
- close(t2);
- textbackground(white);textcolor(red);
- write('Zapisano ' ,podp,': ',zs);
- readkey;end.
Advertisement
Add Comment
Please, Sign In to add comment