String Replace() Method in C#



String Replace() Method in C#

Replace() – The C# Replace() method used to replace the character from given string.
It returns a new string with replaced characters from original string.

C# Example of Replace()

meeraacademy.com
String Replace() Example in C#

In above c# example there are two perameter in Replace(), first one is the character or string that needs to be replaced from given string. The second one is the character or string which replace the first one character in given string.

C# code for Replace() Example()

protected void Button2_Click(object sender, EventArgs e)
{
Label1.Text = TextBox1.Text.Replace("e","z");
}

Subscribe us

If you liked this c#.net post, then please subscribe to our YouTube Channel for more c#.net video tutorials.

We hope that this C#.net tutorial helped you to understand String Replace() method.


Next asp.net tutorial we will learn about C# String Split() Function.


Leave a Reply

Your email address will not be published. Required fields are marked *