Solved

Replace a character with string

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

Expert Comment

by:burakiewicz
ID: 21782120
str.Replace("&","and")
0
 
LVL 31

Accepted Solution

by:
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"); 
//SHOW CORRECT STRING 
MessageBox.Show("Correct string is : " + CorrectString); 

Open in new window

0
 
LVL 13

Expert Comment

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

Author Comment

by:mpaturi1
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.

0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

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

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…
Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
I've attached the XLSM Excel spreadsheet I used in the video and also text files containing the macros used below. https://filedb.experts-exchange.com/incoming/2017/03_w12/1151775/Permutations.txt https://filedb.experts-exchange.com/incoming/201…

756 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