Home > Code > C# > Replace the string within the given string using C#

Replace the string within the given string using C#

by Narain Siddharth   on Nov 13, 2010   Category: C#   |  Views: 1201    |  Points: 25   |  Silver 


class Program
{
static void Main(string[] args)
{
//Replace the string in the given string
string strTest = "This is sample C# string handling program";
string strResult = strTest.Replace("sample", "simple");
Console.WriteLine(strResult);
Console.ReadKey();
}
}



Above C# code snippet used to replace the string within the given string.


Post Code  |  Code Snippet Home

User Responses


No response found, be the first to review this code snippet.

Submit feedback about this code snippet

Please sign in to post feedback

Latest Posts