我在程序中遇到这么一个问题
string fields_str="#Fields: date time c-ip cs-username s-sitename s-computername s-ip s-port cs-method cs-uri-stem cs-uri-query sc-status sc-win32-status sc-bytes cs-bytes time-taken cs-version cs-host cs(User-Agent) cs(Cookie) cs(Referer) ";
但是在调试的时候总是显示fields_str"#Fields: time c-ip cs-method cs-uri-stem sc-status "
这是什么原因,怎么解决,谢谢了

解决方案 »

  1.   

    string fields_str=@"#Fields: date time c-ip cs-username s-sitename s-computername s-ip s-port cs-method cs-uri-stem cs-uri-query sc-status sc-win32-status sc-bytes cs-bytes time-taken cs-version cs-host cs(User-Agent) cs(Cookie) cs(Referer) ";
      

  2.   

    其实我这个字符串不是直接赋值的,是从文件里面读取的
    while (true)
    {
    Row_num=+1;
    str=sr.ReadLine();
    if (str!=null)
    {
    if (str.IndexOf("#Fields:")==0)
    { Fields_str=str.Replace("#Fields: ","");
    Fields_str=Fields_str.Replace("(","_");
    Fields_str=Fields_str.Replace("-","_");
    Fields_str=Fields_str.Replace(")","");
    Fields_str=Fields_str.Replace("date time","date_time");
    Fields_str=Fields_str.Replace(" ",",");
    //Fields_num=Fields_str.Split(new Char [] {','}).Length;
    }
    }
    在str中字符的值就是"#Fields: time c-ip cs-method cs-uri-stem sc-status "
    劳驾看一下怎么解决
      

  3.   

    Row_num=+1;
    错了是Row_num+=1吧?
      

  4.   

    private string read()
    {
    string str;
    StreamReader sr;
    sr = new StreamReader("Field.txt");
    string Fields_str="";
    while (true)
    {
    str=sr.ReadLine();
    if (str!=null)
    {
    // if (str.IndexOf("#Fields:")==0)
    int index = str.IndexOf("#Fields:");
    if (index ==0)
    {
    Fields_str=str.Replace("#Fields: ","");
    Fields_str=Fields_str.Replace("(","_");
    Fields_str=Fields_str.Replace("-","_");
    Fields_str=Fields_str.Replace(")","");
    Fields_str=Fields_str.Replace("date time","date_time");
    Fields_str=Fields_str.Replace(" ",",");
    //Fields_num=Fields_str.Split(new Char [] {','}).Length;
    }
    }
    else
    {
    break;
    }
    } return Fields_str;
    }
    Field.txt:
    #Fields: date time c-ip cs-username s-sitename s-computername s-ip s-port cs-method cs-uri-stem cs-uri-query sc-status sc-win32-status sc-bytes cs-bytes time-taken cs-version cs-host cs(User-Agent) cs(Cookie) cs(Referer)没有什么问题啊。都是你自己写的。
      

  5.   

    你是用什么做的,我用控制台程序写,不出问题,在windows界面的程序中就会出错了
      

  6.   

    这跟是不是控制台没有关系吧?
    我上面的就是winform的。
    如果可以,可以把源码发给我看看。
      

  7.   

    好啊,我留个qq号467879450,msn:[email protected]