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
| Procedure TMaForm.TextBox1TextOnChange(object sender)
var
str2 : string;
key : TStringList;
i : Integer;
begin
key := TStringList.create;
// for each digit in the serial number:
// 1. convert it to int and add 5, then convert it back to string
// 2. if the length of result string is > 1, take the second digit else take the first one
// 3. append that digit to the end of the key
for i := 0 To pred(length(textBox1.Text)) do
begin
str2 := IntTostr(StrToInt(Copy(trim(textBox1.Text),i, 1)) + 5));
if (Length(str2) = 1)
key.Add(str2)
else
key.Add(Copy(str2,1, 1));
end;
textBox2.Text = key.Text;
end;
Procedure TMaForm.Button2Click(object sender)
begin
textBox2.SelectAll();
textBox2.CopyToClipboard();
end; |