Home > DeveloperSection > Forums > How to replace a character “―” in a C# string?
Takeshi Okada
Takeshi Okada

Total Post:89

Posted on    April-12-2015 11:45 PM

 .NET C# 

 1 Reply(s)
 1015  View(s)
Rate this:

i need to replace this "―" character in my c# string i used replace function in multiple ways it did't work. string and code example is below:


string str="The Organisation of abc Cooperation ―OIC";

lbl.Text = str.Replace("—", "").Replace("&#8212", "");

jacob rasel
jacob rasel

Total Post:88

Posted on    April-13-2015 12:09 AM

This is the case where copy-paste works - if you copy the character to string you are searching for it will work.

You also can use correct representation of Unicode charaters like:

   lbl.Text = str.Replace("\u2015", "");

Don't want to miss updates? Please click the below button!

Follow MindStick