How to replace a special character with another special character in a string using C# .Net

Last Reply on Mar 01, 2015 08:36 AM By Mudassar

Posted on Mar 01, 2015 08:34 AM

I want to Replcae Special Characters from String

like My name  $ Is  @ Eshant % Kapoor.

I want to get My name # Is ! Eshant & Kapoor.

Like

$ with #

@ with &

% with !

like this, Means with some values.

 

 

You are viewing reply posted by: Mudassar on Mar 01, 2015 08:36 AM.
Posted on Mar 01, 2015 08:36 AM

There is no automatic way. You need to write a series of Replace functions

string s = "$ Is  @ Eshant % Kapoor";
s = s.Replace("$", "#");

And so on...