Shakeel Hussain Mir
Shakeel Hussain Mir

Reputation: 286

need to replace a character "―" in a C# string

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

Upvotes: 0

Views: 103

Answers (1)

Alexei Levenkov
Alexei Levenkov

Reputation: 100555

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

Upvotes: 6

Related Questions