• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 695
  • Last Modified:

Replace a character with string

How can I replace a char with a string like
str.Replace('&', 'and');
0
mpaturi1
Asked:
mpaturi1
1 Solution
 
burakiewiczCommented:
str.Replace("&","and")
0
 
Frosty555Commented:
Seems to me like you've pretty much written the code out already?
string MainString "String Manipulatin"; 
string CorrectString = MainString.Replace("Manipulatin", "Manipulation"); 
//SHOW CORRECT STRING 
MessageBox.Show("Correct string is : " + CorrectString); 

Open in new window

0
 
joechinaCommented:
str.Replace("&", "and");
0
 
mpaturi1Author Commented:
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.

0

Featured Post

Never miss a deadline with monday.com

The revolutionary project management tool is here!   Plan visually with a single glance and make sure your projects get done.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now