Hello!
I need your help, I don’t know how to be (the point is that the entered word is encrypted in accordance with the table (letter = digit), but there is such a moment that a certain number of letters = a specific number. For example, the combination "CON" = 12. If there is such a combination in the entered word, then it is replaced by 12, and not each letter separately.
The code for tracking this syllable and replacing it with a digit is:
string s1 = textBox1.Text; string s2 = "con"; bool b; b = s1.Contains(s2); if (b = s1.Contains(s2)) { result += 12; }
The encryption code itself is:
for (int i = 0; i < textBox1.Text.Length; i++) { foreach (DataGridViewColumn col in dataGridView1.Columns) { if (col.HeaderText == textBox1.Text[i].ToString()) { result += dataGridView1.CurrentRow.Cells[col.Index].Value; } } } label1.Text = "Результат: " + result;
How do I properly mix these two pieces of code? And then if I write inward if (b = s1.Contains(s2))
, then after each letter I write 12 or other nonsense ...
Help me please! Thank you very much in advance!