Replace a character with string

Posted on 2008-06-13
Last Modified: 2012-08-13
How can I replace a char with a string like
str.Replace('&', 'and');
Question by:mpaturi1
LVL 16

Expert Comment

Comment Utility
LVL 31

Accepted Solution

Frosty555 earned 20 total points
Comment Utility
Seems to me like you've pretty much written the code out already?
string MainString "String Manipulatin"; 

string CorrectString = MainString.Replace("Manipulatin", "Manipulation"); 


MessageBox.Show("Correct string is : " + CorrectString); 

Open in new window

LVL 13

Expert Comment

Comment Utility
str.Replace("&", "and");

Author Comment

Comment Utility
I was missing the left hand side of the str.Replace("&","and");
after making change to the code as

str mystring = str.Replace("&", "and");

It was fine.


Featured Post

Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
network + 7 72
I need C# converted to 1 52
Windows Service to Receive TCP Packets 4 27
COnsume rest client 6 4
Introduction Although it is an old technology, serial ports are still being used by many hardware manufacturers. If you develop applications in C#, Microsoft .NET framework has SerialPort class to communicate with the serial ports.  I needed to…
This article describes a simple method to resize a control at runtime.  It includes ready-to-use source code and a complete sample demonstration application.  We'll also talk about C# Extension Methods. Introduction In one of my applications…
Internet Business Fax to Email Made Easy - With eFax Corporate (, you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…
In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor ( If you're interested in additional methods for monitoring bandwidt…

763 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now