我需要比较 word 文档中的两个字符串,我计算出字母和数字值,但它无法比较包含一些特殊字符的字符串,例如 (Máceres-Cartínez) 这里 a 和 i 出现在特殊字符中,所以它不是比较。
我的代码如下。StreamReader sr = new StreamReader(this.textBox1.Text); 字符串 strValue = sr.ReadToEnd(); 字符串[] strSpliter =新字符串[1];strSpliter[0] = "参考"; string[] strSplitValue = strValue.Split(strSpliter, StringSplitOptions.None); String[] strParaValue = strSplitValue[1].Split(new string[] { "\r\n" }, StringSplitOptions.RemoveEmptyEntries); FileStream fst = new FileStream(@"E:\TrueText.txt",FileMode.Append); StreamWriter swt = new StreamWriter(fst); FileStream fsf = new FileStream(@"E:\FalseText.txt", FileMode.Append); StreamWriter swf = new StreamWriter(fsf);
swt.WriteLine("Startred on :" + DateTime.Now.ToString("yyyy/MM/dd/hh/mm/ss") + "\n");
swf.WriteLine("Startred on :" + DateTime.Now.ToString("yyyy/MM/dd/hh/mm/ss") + "\n");
foreach (string strPara in strParaValue)
{
string[] strAuthorsPart = strPara.Split('.');
string[] strAuthorslist = strAuthorsPart[0].Split(',');
string[] strAuthor = strAuthorslist[0].Split(' ');
if (strSplitValue[0].Contains(strAuthor[0].Trim()))
{
swt.WriteLine(strAuthor[0] + "\t");
}
else
{
swf.WriteLine(strAuthor[0] + "\t");
}
有没有人指导我如何解决这个问题?
谢谢迪戈