Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/336.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 需要替换一个字符"―&引用;用C字串_C#_Asp.net_String - Fatal编程技术网

C# 需要替换一个字符"―&引用;用C字串

C# 需要替换一个字符"―&引用;用C字串,c#,asp.net,string,C#,Asp.net,String,我需要在我的c#字符串中替换这个“―”字符,我用了多种方法替换函数,但它不起作用。字符串和代码示例如下所示: string str="The Organisation of abc Cooperation ―OIC"; lbl.Text = str.Replace("—", "").Replace("&#8212", ""); 这是复制粘贴工作的情况-如果将字符复制到正在搜索的字符串中,它将工作 您还可以使用Unicode字符的正确表示形式,如: lbl.Text = str.R

我需要在我的c#字符串中替换这个“―”字符,我用了多种方法替换函数,但它不起作用。字符串和代码示例如下所示:

string str="The Organisation of abc Cooperation ―OIC";
lbl.Text = str.Replace("—", "").Replace("&#8212", "");

这是复制粘贴工作的情况-如果将字符复制到正在搜索的字符串中,它将工作

您还可以使用Unicode字符的正确表示形式,如:

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

这是复制粘贴工作的情况-如果将字符复制到正在搜索的字符串中,它将工作

您还可以使用Unicode字符的正确表示形式,如:

   lbl.Text = str.Replace("\u2015", "");
不是C语言中的字符转义序列。您需要使用
\u
转义。
&8212
不是C中的字符转义序列。您需要使用
\u
转义。