Pages

Sunday, March 17, 2013

C#: Replace a String

public void ReplaceString()
{
   string str = "Hello how are you!";
   string result= str.Replace(" ","--");
   Console.WriteLine(result);
}

Output: Hello--how--are--you!

No comments:

Post a Comment