Bonjour,
je veux savoir svp comment convertir ce code en c# en delphi
Cordialement,
Code c# : Sélectionner tout - Visualiser dans une fenêtre à part
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 void TextBox1TextChanged(object sender, EventArgs e) { StringBuilder key = new StringBuilder(); // 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 (int i = 0; i < textBox1.Text.Length; i++) { string str2 = (Convert.ToInt32(textBox1.Text.Trim().Substring(i, 1)) + 5).ToString(); if (str2.Length == 1) key.Append(str2); else key.Append(str2.Substring(1, 1)); } textBox2.Text = key.ToString(); } void Button2Click(object sender, EventArgs e) { textBox2.SelectAll(); textBox2.Copy(); }
Partager