HOW TO REPLACE A CHARACTER “―” IN A C# STRING?

Takeshi Okada

Total Post:89

Points:629
Posted by  Takeshi Okada
C# 
 1144  View(s)
Ratings:
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", "");
  1. jacob rasel

    Post:88

    Points:616
    Re: How to replace a character “―” in a C# string?

    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", "");

Answer

NEWSLETTER

Enter your email address here always to be updated. We promise not to spam!