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

ID: 21782120
LVL 31

Accepted Solution

Frosty555 earned 20 total points
ID: 21782141
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

ID: 21782271
str.Replace("&", "and");

Author Comment

ID: 21852096
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

What is SQL Server and how does it work?

The purpose of this paper is to provide you background on SQL Server. It’s your self-study guide for learning fundamentals. It includes both the history of SQL and its technical basics. Concepts and definitions will form the solid foundation of your future DBA expertise.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
New to SOAP and need some direction 10 82
Page navigation in windows phone 8.1 application not working. 5 24
Best resource to learn entity framework 2 33
Service Controller 1 23
This article introduced a TextBox that supports transparent background.   Introduction TextBox is the most widely used control component in GUI design. Most GUI controls do not support transparent background and more or less do not have the…
We all know that functional code is the leg that any good program stands on when it comes right down to it, however, if your program lacks a good user interface your product may not have the appeal needed to keep your customers happy. This issue can…
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

778 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