Solved

Replace a character with string

Posted on 2008-06-13
4
690 Views
Last Modified: 2012-08-13
How can I replace a char with a string like
str.Replace('&', 'and');
0
Comment
Question by:mpaturi1
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

[Webinar] Code, Load, and Grow

Managing multiple websites, servers, applications, and security on a daily basis? Join us for a webinar on May 25th to learn how to simplify administration and management of virtual hosts for IT admins, create a secure environment, and deploy code more effectively and frequently.

Question has a verified solution.

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

Suggested Solutions

This article is for Object-Oriented Programming (OOP) beginners. An Interface contains declarations of events, indexers, methods and/or properties. Any class which implements the Interface should provide the concrete implementation for each Inter…
This article aims to explain the working of CircularLogArchiver. This tool was designed to solve the buildup of log file in cases where systems do not support circular logging or where circular logging is not enabled
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

737 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