string tempUrlStr = fun.GetRequestString(Url,1000000,1,System.Text.Encoding.GetEncoding("GB2312"));
int lenA = tempUrlStr.IndexOf("</td><td><p><font color=red>",0);
int lenB = tempUrlStr.IndexOf("阅读本书】</font></a>",lenA);
tempUrlStr=tempUrlStr.Substring(lenA,lenB-lenA);
Response.Write(tempUrlStr);tempUrlStr输出的内容是正确的,,在里面有要查找的"</td><td><p><font color=red>"而且只有一个,,但就是查找不到,,lenA为-1;;;这是怎么回事....

解决方案 »

  1.   

    我刚刚也碰到在tempUrlStr源字符串中如果有"="这个字符就会出错,跟踪结果IndexOf()不存在。我也不知道为什么?还请高手解答
      

  2.   

    string strconnstring= lab_DBConnstr.Text; 
    if (strconnstring.IndexOf("Provider=SQLOLEDB")>0)

      
    str_DBtype="SQLServer";
    }
    else
    {
    str_DBtype="Other";
    }
    strconnstring="Provider=SQLOLEDB.1;Persist Security Info=False;User ID=sa;Initial Catalog=tideoa;Data Source=."
    strconnstring.IndexOf("Provider=SQLOLEDB") 错误:“strconnstring.IndexOf”不存在
      

  3.   


    Provider=SQLOLEDB.1;
    Provider=SQLOLEDB
    经过调试比较字符应该是一样的。大小写的问题可以排除?