0

I have a problem. I'm making the 1337 7r4|\|5l4704 (leet speak translator) and i want to have multiple chars to replace with one other.

for example I want to replace "A" and "a" with "4" in one command. I have something like this:

    private void button1_Click(object sender, EventArgs e)
    {
        textBox2.Text = "";
        string a = textBox1.Text;
        string sr = a.Replace("A", "4");
        textBox2.Text = sr;
    }

How can I do it?

0

1 Answer 1

0

Try

string sr = a.Replace('A', '4').Replace('a', '4');
Sign up to request clarification or add additional context in comments.

2 Comments

This does not provide an answer to the question. To critique or request clarification from an author, leave a comment below their post.
The OP asks for example I want to replace "A" and "a" with "4" in one command, which my answer addresses. Unless you mean Replace daisy chained means more than one command.