1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22: 23: 24: 25: 26: 27: 28: 29: 30: 31: 32: 33: 34: 35: 36: 37: 38: 39: 40: 41: 42: 43: 44: 45: 46: 47: 48: 49: 50: 51: 52: 53: 54: 55: 56: 57: 58: 59: 60: 61: 62: 63: 64: 65: 66: 67:
| unit Unit1;
interface
uses Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls , iniFiles;
type TForm1 = class(TForm) bcodieren: TButton; bdecodieren: TButton; procedure bcodierenClick(Sender: TObject); private public end;
var Form1: TForm1; ini: TMemIniFile;
implementation
{$R *.DFM}
var text:string;
function codieren(text:string):string; begin text:=StringReplace(text, '1', '!', [rfReplaceAll]); text:=StringReplace(text, '2', '$', [rfReplaceAll]); text:=StringReplace(text, '3', '\', [rfReplaceAll]); text:=StringReplace(text, '4', '°', [rfReplaceAll]); text:=StringReplace(text, '5', '#', [rfReplaceAll]); text:=StringReplace(text, '6', '`', [rfReplaceAll]); text:=StringReplace(text, '7', '§', [rfReplaceAll]); text:=StringReplace(text, '8', '^', [rfReplaceAll]); text:=StringReplace(text, '9', '_', [rfReplaceAll]); text:=StringReplace(text, '0', '~', [rfReplaceAll]); Result:=text; end;
procedure TForm1.bcodierenClick(Sender: TObject); var i,n: integer; begin ini:=TMemIniFile.Create('c:\test.ini'); try For n:=1 to 5 do begin For i:=1 to 5 do begin text:=ini.ReadString(inttostr(n),inttostr(i),''); text:=codieren(text); showmessage(text); ini.WriteString(inttostr(n),inttostr(i),text); end; end; finally ini.free; end; showmessage('Ok'); end;
end. |