我正在尝试从网站获取文本描述并使用此代码
HttpResponseMessage response1 = await httpClient.GetAsync(url);
response1.EnsureSuccessStatusCode();
string srcCode = await response1.Content.ReadAsStringAsync();
string desc = "";
rem = @"id=""full_notes"">";
if (srcCode.IndexOf(rem) != -1)
{
desc = srcCode.Remove(0, srcCode.IndexOf(rem) + rem.Length);
rem = @"<a href=""#"">less</a></span>";
desc = desc.Remove(desc.IndexOf(rem));
}
else
{
rem = @"<span>Description:</span>";
desc = srcCode.Remove(0, srcCode.IndexOf(rem) + rem.Length+15);
rem = "</div>";
desc = desc.Remove(desc.IndexOf(rem));
}
string rep = @"""";
desc.Replace(""",rep);
on.Description = desc;
一切顺利,我将它显示在一个文本块中,但是当我得到的文本有引号“”时问题就来了,那么文本块只会显示 " 而不是“有人知道如何解决这个问题吗?
注意:我尝试使用替换,如代码所示,它不起作用